Volume 4, Issue 2 FEBRUARY, 1982
Price $1 .50
Information Published for TRS-80 users.
Color Computer
Assembly Language
by William Barder
"**
Random Files
%
Hard Disk Information
&
L
* »
r -K^\
*V
X j»f <
**:*
' f ^ V ^
v^
5/
^-/vv;
fcfe
j * i
v.
V
y*
r ' :V ■ '
-0.-56
~<
Ai
-t:
- J -J*
03 <£
JJ*t &D
CQLQq v .
m
Ctrf^fl-yjij^jj
"A
^>
^
3*/
■'/
/
Radio Shack Computer Centers
Mean Total Customer Su
• • •
The Only Location Where You'll Find the
Complete Line of TRS-80® Computers,
Accessories, Software, and Special
Services
Total Support Means . . .
Quality Software At Low Prices
A Computer Center is the place to find the quality
TRS-80 software you need. We offer more ready-to- run
programs than any other microcomputer manufacturer.
We have programs for business, industry, education,
the professions, personal applications, even games!
And, you can choose our software packages "right off
the shelf" because they're in stock at Computer Cen-
ters nationwide.
Total Support Means . . .
Complete Training Facilities
Our professional seminars will acquaint you and your
personnel with our TRS-80 computer systems. You'll
get "hands-on" experience, because you'll be using
the TRS-80 while you learn. Develop BASIC program-
ming skills, learn specific business applications and
more. We even have free scholarships for educators.
Total Support Means . . .
A Professional Staff
Radio Shack Computer Centers are staffed by trained
experts who can help you reach a decision on just the
TRS-80 computer system you need. How? By under-
standing your needs, and by answering all your ques-
tions in plain English. They can explain our leasing,
service, and training plans, too. For example, you can
ease any system over $1500!
Total Support Means . . .
More Than Just Computers!
Computer Centers offer you a full line of TRS-80 periph-
erals, software, and other business-related accesso-
ries, including business and personal copiers,
telephone dialers and answerers, workstation furniture,
printed forms, and more. All this, in addition to the
world's best-supported microcomputer — Radio
Shack's TRS-80!
Total Support Means . . .
Keeping Your System Up and Running
Service is available through all of our Computer Cen-
ters. In fact, most Centers have complete service facil-
ities on the premises. You'll receive the kind of prompt,
courteous attention you expect. We want to get you
back in service as soon as possible. That's why
Radio Shack offers affordable "In^Shop" and, in most
areas, convenient "On-Site" and "Limited On-Site"
service agreements.
Total Support Means . . .
Prompt, Personal Assistance
Our Customer Service Representatives are devoted to
helping you with any after-the-sale questions or prob-
lems. You receive complete technical assistance and
support, whether you've purchased one system or one
hundred. Radio Shack Computer Centers simply give
you the best support you'll find anywhere.
mm
On the Cover. The versatile Color Computer has graphic capabilities which can challenge your imagination indefinitely. The image on the screen could
be printed on the Line Printer VII or saved to tape on the CTR-80A so that it could be reloaded for future enjoyment.
TRS-80 Microcomputer News: ® 1982
Tandy Corporation,
Fort Worth, Texas 76102 U.S.A.
All Rights Reserved
Reproduction or use, without express written permission from
Tandy Corporation of any portion of the Microcomputer News is
prohibited Permission is specifically granted to individuals to use
or reproduce material for their personal, non-commercial use.
Reprint permission for all material (other than William Barden's
article), with notice of source, is also specifically granted to
non-profit clubs, organizations, educational institutions, and
newsletters,
TRS-80 Microcomputer News is published monthly by
Radio Shack, a division of Tandy Corporation. A single six-month
subscription is available free to purchasers of new TRS-80
Microcomputer systems with addresses in the United States, Can-
ada and APO or FPO addresses Subscriptions to other ad-
dresses are not available. The subscription rate for renewals and
other interested persons with U.S., APO or FPO addresses is
twelve dollars ($12.00) per year, check or money order. Single
copies of the Microcomputer News may be purchased from
Radio Shack Computer Centers or Computer Departments for
$1 ,50 suggested retail each. The subscription rate for renewals
and other interested persons with Canadian addresses is Eight-
een dollars ($1 8, 00) per year, check or money order in U ,S. funds
All correspondence related to subscriptions should be sent to:
Microcomputer News, P.O. Box 2910, Fort Worth, Texas
76113-2910,
Retail Prices in this newsletter may vary at individual stores
and dealers. The company cannot be liable for pictorial and
typographical inaccuracies.
Back issues of Microcomputer News prior to January, 1981
are available through your local Radio Shack store as stock num-
ber 26-2115 (Suggested Retail Price $4,95 for the set) Back
issues of 1981 copies are not available.
The TRS-80 Newsletter welcomes the receipt of computer
programs, or other material which you would like to make availa-
ble to users of TRS-80 Microcomputer systems In order for us to
reprint your submission, you must specifically request that your
material be considered for reprinting in the newsletter and provide
no notice that you retain copyrights or other exclusive rights in the
material. This assures that our readers may be permitted to recopy
and use your material without creating any legal hassles.
Material may be submitted by mail to P.O Box 2910, Fort
Worth, Texas 76113-2910, or through CompuServe, The Micro-
computer News' CompuServe user ID number is 70007,535.
Notes to Program Users:
Programs published in the Microcomputer News are pro-
vided as is, for your information. While we make reasonable efforts
to ensure that the programs we publish here work as specified,
Radio Shack can not assume any liability for the accuracy either
of the programs themselves, or of the results provided by the
programs
Further, while Microcomputer News is a product of
Radio Shack, the programs and much of the information
published here are not Radio Shack products, and as such can
not be supported by our Computer Customer Service group. If
you have questions about a program in the Microcomputer News,
your first option is to write directly to the author of the program.
When possible, we are now including author's addresses to facili-
tate communications. If the address is not published, or if you are
not happy with the response you get, please write us here at
Microcomputer News,, We will try (given the limited size of our staff)
to find an answer to your question and, in many cases, will publish
the answer in an up-coming issue of Microcomputer News
Comments on our program listing style:
In order to make the program listings we publish easier to
read, we have adopted a style of inserting spaces to enchance
readability, and we separate each program statement onto a
separate lin'e. While these techniques increase program readabil-
ity, they also require more memory, and may execute more slowly
then the original program did
When you are entering a program for your own use, you may
wish to eliminate many of the extra blanks (see your owners
manual for required blanks), and you should certainly move multi-
ple statements up to a single line where possible
Trademark Credits
Volume 4, Issue 2 FEBRUARY, 1982
Price $1 .50
CompuServe®
DIF®
Dow Jones®
Personnel Manager®
Project Manager®
ReformaTTer®
Time Manager®
VisiCalc®
CompuServe, Inc.
Personal Software, Inc.
Dow Jones Co,
Image Producers
Image Producers
Microtech Exports
Image Producers
Personal Software, Inc.
Program Pak® Tandy Corporation
SCRIPSIT® Tandy Corporation
TRSDOS® Tandy Corporation
TRS-80® Tandy Corporation
TRS-80
Microcomputer News
Information Published far TRS-80 users. ■
Contents:
Assembly Language Programming 7
by William Barden, Jr.
Color Computer
Product Line Manager's Page 37
BASICally Speaking
Programs
3-D Color Graphics by Mark Granger 39
Biorhythms by Kenneth A. Mowen 44
Bouncing Box by W. Tudor Apmadoc : 44
Joystick Draw Routine by Jim Ebbert 38
Print Videotex Material by Jorge Mir 33
Space Alert by J.W. Myers 41
Computer Clubs 14
Computer Customer Service 16
Questions We Ask You
Data Bases
CompuServe 12
Confessions, Refundle Bundle, Raylux Reports
Notes off the CompuServe Wire 14
Educational Products
Essential Math Series 29
Feature Story
Random Files 5
Fort Worth Scene 11
Genera! Interest
&, &H and VAL by Bill Dickson 24
Model I/III
Bugs, Errors, and Fixes
Accounts Receivable (26-1 555) 22
Disk Payroll (26-1556) 22
Profile (26-1562) 22
RSCOBOL (26-2203) 23
TRSDOS Model III (26-312) 21
Product Line Manager's Page 20
More PRINT USING with articles by Johnny Bond, Earl R. Kooi, Quincy G. Leslie, and
J. Nelson Phillips
Programs for Models I and HI
FORTRAN/BASIC Data Files by John L. Montgomery 24
Instant Recall by Dwight Dager 25
Microfile Hints by William Smith 15
PRINT to LPRINT Modifications 23
Articles by Al Reudisuelli and John C. Miller
Quick Label by Roy W. MacLean 28
Stunt Racer by York Maksik and Mike Zive 27
Model II
Bugs, Errors, and Fixes
Bi-Synch Communications 3270 (26-4715) 35
Bi-Synch Communications 3780 (26-4716) 35
Profile II (26-4512) 35
SCRIPSIT 1 .0 (26-4530) 35
SCRIPSIT 2.0 (26-4531) 35
Product Line Manager's Page 34
Hard Disk System
Programs
Garbage Collection by William L. Pierce 36
Typewriter by David F Salisbury 36
Peripherals
Product Line Manager's Page 19
Direct Connect Modem II
Programs
Line Printer VI Control Program by H. Richard Priesmeyer 33
LP VI Underline/Boldface by Don Wood 15
Pocket Computer
Product Line Manager's Page (Does not Appear)
Programs
Printer Plot by Herbert G. Dorsey III 46
Star Trek Fight by Robert Saccone, Jr. 45
View From the 7th Floor by Jon Shirley 4
TRS-80 Microcomputer News, February 1982
View From The Seventh Fl
by Jon Shirley,
Vice President,
Radio Shack Computer Merchandising
• :•
This column is being done so late that we almost had a
blank page this month. All right, I can hear the snickers out
there. The reason is that I have been doing a lot of traveling. I
went to Las Vegas to see the COMDEX show which is a very
good trade show aimed at what are called ISO's— Indepen-
dent Sales Organizations. That means both retail computer
dealers and the OEM's or systems houses, who are the
people who buy computers to resell with their software. It was
a costly experience since the casinos made off with their
share of my money, but the show was great. You just have no
idea how many people there are in this business these days.
At least three new computers were introduced there plus
bunches of peripherals and software. At times I really wonder
if there are enough customers to buy all that stuff.
After a few hours at the show you get the impression that
all the computers start to look alike and most seem to work
alike. The difference comes from the software and the sup-
port the different manufacturers do or do not offer. A second
generation of software is just around the corner which will be
much easier to use and far more interactive from program to
program. After all it does not really matter what is inside of the
CPU as long as the software will do what you, the customer,
needs. We ran our entire company on a mainframe with a
core memory of 8K only 1 7 years ago and at that time that
was an expanded memory.
After COMDEX I went to Florida to attend a word proc-
essing conference. This was a real insider show with repre-
sentatives from all the big name word processing companies
there. There were 1 1 people from IBM alone although they
did not offer a speaker. I'was very pleased to learn that in the
low-end market word processors, which includes the IBM
Display Writer, the Wangwriter and some other famous
names, we are ranked in the top four with the Model II and
SCRIPSIT During the conference yet another personal com-
puter was announced. This one will be from Olivetti and will
be officially announced about the time you read this. I guess
that will be the first one from Europe to make these shores
except for Sinclair.
I would like to apologize to all of you who have been
waiting for some of our software which is late. Especially
those Model III owners who waited so long for VisiCalc,
FORTRAN and the Editor Assembler. I have heard from a lot
of you and all I can offer as a word of explanation is that we
really do try not to announce a new product until we are fairly
sure of its release date. That means it is in test and looking
good. Of course this leaves us wide open to Murphy's law
which says that if anything can go wrong, it will. The software
law should be that even if nothing can go wrong it will anyway.
Sometimes the most solid looking package will develop
a strange bug that defies all efforts to be found. Or even
worse, the fix of that bug generates another bug and the test
cycle is repeated again, and again, and— well you get the
point. Our policy for the monthly flyers is that if an item is not in
stock when the advertising material goes to the printer it will
not be included in the flyer. This has been working correctly,
it's the catalogs that are supposed to last for several months
that get us in trouble. We like those catalogs to include new
products that may not be available for up to four months after
the book comes out, yet we are doing the book way in
advance of its print date. We try to be conservative in those
dates but we do miss. All I can promise is that we will try to do
better and be more conservative. Remember we are excited
about our new products and want you to be also. So please
accept our apologies and try to understand that we know
how you feel and we do not do it on purpose.
Color Computer owners might be interested in a monthly
cassette by mail publication called Chromasette Magazine.
It's for extended BASIC owners only and has about 6 pro-
grams per month. I have looked at a few and some are very
neat and all can help you learn to program. Write to Chroma-
sette at P.O. Box 1087, Santa Barbara; Ca. 93102 for details.
In the last issue, the flyer that came with it had a review on the
disk system and said we should have included 8K RAM on
the disk controller board so no RAM at all was taken up by the
DOS. It's a neat idea even though we take up less RAM than
virtually any other disk system, but our engineers said it was
not a workable idea for a variety of reasons plus we did not
think it would have been worth the extra cost.
I just took home a copy of Art Gallery for the Color
Computer and I think it's a worth a look by you C.C. owners,
especially if you have young kids. Around my house it is
almost as popular as Space Assault. It comes with a key-
board overlay to identify what the keys do and it makes
creating exciting graphics really easy. If any of you have a use
for a sign that is in color on a TV screen which can have letters
of different shapes and sizes plus simple graphics, take a look
at this package. I know of one very big company (not us) who
uses Color Computers as signs to direct people around their
facility. The "signs" can be easily changed each day as the
need arises. It is also useful as a store window silent salesman
when the store is closed.
I never get bored hearing of the many different applica-
tions that people find for our computers and if you have one
that is unique drop us a line. I know of one company that built
a Model I into the chicken breeding buildings they sold to
control temperature and other things. Now that is a really
unique use.
Finally I would like to thank the gentleman who wrote me
a very nice letter and said he thought I reacted too much in
this column to the "bozos" who wrote in with their problems.
He said don't forget the great majority of owners who like their
TRS-80, read the newsletter, and do not write letters. Consid-
ering the very large mass of owners we have and the very few
(Continued on page 6)
TRS-80 Microcomputer News, February 1982
Feature Story
Random Access Files
Random (or direct) access files allow you to change data
in any record or to directly access any record in a file.
RANDOM FILE STATEMENTS
1. OPEN
The first statement in creating a Random (Direct access
on Model II) file is the OPEN statement. The following are
example OPEN statements.
OPEN "R", 1, "NAMES/TEL" Model I, III
OPEN "D", 1, "NAMES/TEL" Model II
If the file NAMES/TEL already exists, it is OPENed for
access. If the file NAMES/TEL does not already exist, it is
created at this time. The "R" (or "D" for Model II) specifies
that the file access will be Random which means that you will
be able to both GET (read) records from or PUT (write)
records to the file.
1 - This number specifies a buffer - in this case buffer #1 .
If the OPEN statement had been OPEN "R",5, NAMES/TEL
then access to the file NAME/TEL would be through buffer 5.
Any access of a random file will be done through the
buffer indicated in the OPEN statement. From 1 to 15 buffers
can be open at one time. On the Model I and III the number
of buffers open at a time is determined by the response to the
HOW MANY FILES? prompt in Disk BASIC.
Responses to HOW MANY FILES? prompt- Model I/III
HOW MANY FILES? <ENTER> 3 buffers reserved
HOW MANY FILES? n n buffers will be availa-
ble for file use where n
= 's any number from
to 15.
Model II Disk BASIC requires a TRSDOS entry like:
BASIC -F:5
which loads BASIC and sets aside 5 buffers for file access. If
the TRSDOS entry is 'BASIC then buffers are reserved.
Model II may have from to 1 5 buffers available for file use.
"NAMES/TEL" - This TRSDOS file name follows stand-
ard TRSDOS format for file names.
2. FIELD
The FIELD statement provides access to the Random file
buffer by determining how the data is organized in the buffer
and subsequently stored on disk or read into your program.
FIELD 1, NME$ AS 30, NUM$ AS 8
In this file each record will consist of two fields. (Field is
not to be confused with the statement FIELD.) The first field is
NME$, the name which we will use for name and the second
field NUM$ which we will use for the phone number.
Using the FIELD statement, the number of bytes the
fields (NME$ and NUM$) are going to use in the record is
determined. The total length of the two fields in this example is
38 bytes but when the record is stored on disk it will take up
256 bytes of storage space. With variable length records the
disk space can be organized more efficiently but that is a
subject for another article.
3. LSET, RSET
These commands are used to move the data items into
the buffer fields previously defined by the FIELD statement.
Either LSET (for Left Set) or RSET (for Right Set) can be used.
If we LSET, the data for the name field (NME$) will be moved
into the 30 byte field of the buffer beginning in the leftmost
position of the field. With RSET the last character in the string
will be the rightmost character in the field.
As a demonstration of LSET and RSET consider the
following examples.
NME$ = "Jon Jones"
b's represent unused (blank) field space.
Each box represents the 30 byte field for NME$.
LSET- When NME$ is LSET into the buffer field
it can be represented like this.
Jon Jones\bmm\b\bmmmmmmm
RSET - When NME$ is RSET into the buffer field for
NME$ it can be represented like this.
m\bmmmmmmm\b\b\b\bJon Jones
LSET NME$ = "John Smith" (If N$ = "John Smith" then
LSET NME$ = N$ could be
used.)
LSET NUM$ = "444-4444" (If T$ = "444-4444" then
LSET NUM$ = T$ could be
used.)
Once the information has been LSET or RSET it can be
PUT (written) on disk.
4. PUT
PUT n, n1 - The first number in the PUT statement is the
buffer number and must match the buffer number which was
used in the OPEN statement. "n1 " is the record number to be
written to disk. If " n1 " is not indicated and the file has not been
previously written to, the record will be written as record
number one. If the file has previously been written to, the
record currently in the buffer will be written to the next record
position.
To write a record, a statement like the following would
be used.
PUT 1,5
PUT 1 ,5 causes the record currently stored in buffer #1
to be written in the 5th record position of the disk file.
5. GET
GET n, n1 - The GET statement enables you to GET
(read) a record which has previously been PUT (written) on
disk, "n" is the same buffer number which was used in the
OPEN statement. "n1" specifies the record to be read (with
GET) from the disk file. If "n1 " is omitted the current record
will be read. If this is the first time that the file has been
accessed in the program then the current record will be
TRS-80 Microcomputer News, February 1982
number one. If it is the sixth time that the file has been
accessed then the current record number is six.
6. CLOSE
CLOSE n, n1, . . . When file access is completed then
the file must be CLOSEd. The CLOSE statement insures that
any information still in the buffer is written to disk. In the
statement CLOSE 1 , 2 only the OPEN files which are using
buffers 1 and 2 are CLOSEd. CLOSE with no buffer numbers
causes all OPEN files to be closed.
EXAMPLES
The two brief programs that follow are included to illus-
trate the use of the Random file statements discussed above.
Program I will ask for input of names and telephone numbers
which will be written to disk. Program II will open NAME/
NUM, GET the record number that you specify and print it on
the screen.
PROGRAM I
100 CLS
110 OPEN"R",1,"NAME/NUM"
120 FIELD 1, 30 AS NME$, 10 AS NUM$
130 FORX = 1 TO 5
140 INPUT "NAME"; N$
150 INPUT "PHONE"; T$
160 CLS
170 LSETNME$ = N$
180 LSETNUM$ = T$.
190 PUT1.X
200 NEXTX
210 CLOSE
Lines 100 & 160 - Clear the screen
Line 1 10 - OPENs the file NAME/NUM for Random (Direct)
access in buffer 1 .
Line 120 - FIELDs buffer 1 with 30 bytes for NME$ and 10
bytes as NUM$.
Lines 130 & 200 - Set up a five step loop.
Line 140 - Allows entry of a name (actually any string) each
time through the loop.
Line 150 - Allows entry of a telephone number (again any
string) each time through the loop.
Line 170 - LSETs NME$ equal to N$ - the name entered in
line 140.
Line 1 80 - LSETs NUM$ equal to T$ - the number entered in
line 150.
Line 190 : Writes the record in buffer #1 to disk. The record
numbers will be 1 through 5.
Line 21 - CLOSEs NAME/NUM which is the only open file in
this program.
PROGRAM II
510 OPEN"R",1, "NAME/NUM"
520 FIELD 1, 30 AS NME$,10 AS NUM$
530 INPUT "WHICH RECORD (1-5)"; X
535 IF X<1 OR X>5 GOTO 570
540 GET 1 , X
550 PRINT NME$; NUM$
560 GOTO 530
570 CLOSE
Line 510 - OPENs the file NAME/NUM for Random (Direct)
access using buffer number 1 .
Line 520 - FIELDs buffer 1 with 30 bytes for NME$ and
10 bytes for NUM$.
Line 530 - Prompts user to enter the number of the record to
be read from disk.
Line 535 - Checks to see if the number input is greater than 1
or less than 5. If either condition is true then execution
goes to line 570 where all open files are closed.
Line 540 - The record number specified in line 530 is read
from disk.
Line 550 - PRINTs the names (NME$) and phone numbers
(NUM$) after they are read in from disk.
Line 560 - Returns to line 530.
Line 570 - CLOSEs the OPEN file NAME/NUM.
Seventh Floor
(From page 4)
letters I do get he is right and I thank him for putting things in
perspective. 1 982 is going to be a good year for you TRS-80
owners, I know what is arriving this year and there will be
something for everyone.
Until next month . . .
Last-Minute P.S.: It seems there is a rumor to the effect
that non-FCC approved equipment may not be sold as of
January 1, 1982. The December '81 issue of 80 Microcom-
puting states this as "may not be marketed." Sorry Wayne,
ABSOLUTELY NOT CORRECT. The law states that com-
puters and peripherals subject to class B requirements
(Models I, III and Color Computer) may not be manufactured
after January 1 , 1 981 (not 1 982). Anything made before that
date can be sold at any time. We obtained permission to
make Model I expansion interfaces for one additional year
and as of December 30, 1981 we are not making any more
E.L's, although they should be available from our stores until
around the end of June.
TRS-80 Microcomputer News, February 1982
Color Computer Assembly
Language Programming
by William Barden, Jr.
® William Barden, Jr.
I was sipping my Diet mineral water and munching on
lo-cal cheesecake for lunch (writers tend toward corpulence)
when my office phone rang. "Is this William Barden, Jr. author
of Radio Shack's 'TRS-80 Assembly Language Program-
ming'?" "Yes," I admitted, eyeing the remainder of the
cheesecake. "I have a collect call for you from Radio Shack,
Fort Worth. Will you accept the charges?" "Yes, Operator."
Twenty minutes later, I hung up the phone and finished
the cheesecake. Incredible! What a coup I had pulled! I had
promised to do a series of articles on assembly language
programming on the Golor Computer. In return I would get
complimentary copies of the newsletter. And people say that
Radio Shack drives a hard bargain . . .
I n fact, this is the first of a series of articles on that subject.
I can't promise that I'll make a Color Computer assembly
language programmer out of you with a short monthly col-
umn. At least not without your help. I can promise you enthu-
siastic material on assembly language programming on the
CC. I'll start from the ground up, but you'll have to promise
me that you'll supplement the columns with independent
study. I know that you're going to enjoy some of the things
that can be done with assembly language on the CC. Read
on, and I'll give you an example.
IS MACHINE LANGUAGE CLlC^T AND WHIRRS?
At this point you're probably pretty familiar with Color
BASIC or Extended Color BASIC. You might have even no-
ticed the DEFUSR and USR commands in BASIC. These are
hooks to "machine language" code that may be called from
BASIC. Machine language is the end product of assembly
language.
Take the program below. It shows an assembly lan-
guage listing for a program to output SOUND through the TV
speaker. (Unlike the SOUND or PLAY command in BASIC, it
can output a variety of sounds, and not just notes.) We'll use it
as an example to explain assembly language and machine
language and come back to it later on.
EDIT
MACHINE-LANGUAGE
LINE
ASSEMBLY-LANGUAGE
CODE
A
NUMBERS
00100
CODE
A
/
\
*****************************************
00110
* SOUND
PROGRAM,
. OUTPUTS SOUND BYTES FROM BUFFER *
00120
******************************************************
0000
10BE
3F00
00130
SOUND
LDY
$3F00
GET # OF TIMES
0004
BE
3F03
00140
SND010
LDX
$3F03
GET START ADDRESS
0007
A6
80
00150
SND020
LDA
,x+
GET NEXT BYTE
0009
48
00160
LSLA
ALIGN
000A 48
00170
LSLA
000B
B7
FF20
00180
STA
$FF20
OUTPUT
000E
8D
0C
00190
BSR
DELAY
DELAY
0010
IF
10
00200
TFR
X,D
CURRENT BYTE ADDR TO A,B
0012
B3
3F05
00210
SUBD
$3F05
SUBTRACT END
0015
26
F0
00220
BNE
SND020
GO IF NOT END
0017
31
3F
00230
LEAY
-1,Y
DECREMENT # OF TIMES
0019
26
E9
00240
BNE
SND010
GO IF NOT
001B
39
00250
RTS
RETURN - DONE
001C
B6
3F02
00260
DELAY
LDA
$3F02
GET DELAY COUNT
001F
4A
00270
DEL010
DECA
COUNT- 1
0020
26
FD
00280
BNE
DEL010
GO IF NOT
0022
39
0000
00290
00300
RTS
END
RETURN
00000 TOTAL ERRORS
Figure 1 . SOUND Assembly Language Program
TRS-80 Microcomputer News, February 1982
The portion of the program on the right labeled "assem-
bly language" is the actual text that is input. This text is
processed by the Color Computer Editor/Assembler. The
Editor/Assembly (after some coaxing), spews out the code on
the left, labeled "machine language".
The machine language is really the binary data (ones
and zeroes) that the 6809E microprocessor in the Color
Computer understands. The binary data is in a shorthand
form of binary called "hexadecimal" data. Hexadecimal is
usually called "hex".
The machine language code in binary is put either onto a
cassette tape "object" file so that it can be loaded into the CC
by a CLOADM command, or put directly into RAM (random
access memory) so that it can be tested (debugged).
THE HEART OF THE COLOR COMPUTER
The 6809E microprocessor is the heart of the CC. It has a
built-in instruction set that is represented by machine codes
such as the ones on the listing. These instructions are quite a
bit different than BASIC instructions. They're very rudimen-
tary, to put it nicely. You might compare BASIC to machine-
code instructions the way you'd compare a James Joyce
novel to a first-grade primer.
The 6809E can add two numbers, subtract two num-
bers, alter the sequence of instructions (a GOTO), load a
number into a 6809E register, and do other types of process-
ing at about this level. About the most powerful operation the
6809E can do is multiplication of two 8-bit numbers. This is
not to say that the 6809E is not a powerful microprocessor! It
is an excellent example of semiconductor design, lest I offend
Motorola engineers. It just understands things on the "See
the computer. Run, computer. Run, run, run!" level.
And that's the crux of the problem! We've got to string
the rudimentary commands of the 6809E together to form
some meaningful programs. It's certainly harder than BASIC.
X INDEX REGISTER
Y INDEX RESISTER
U USER STACK
S HARDWARE STACK
PC PROGRAM COUNTER
A ACCUMULATOR 1 B ACCUMULATOR"]
D ACCUMULATOR
DP DIRECT PAGE
E F H I N Z V C
INTERRUPT
RELATED,
HALF CARRY
CONDITION
CODES
J CARRY
OVERFLOW
ZERO
NEGATIVE
Figure 2. 6809E Programming Model
However, the resulting machine language program will be
extremely fast and the rewards will be great.
To start our odyssey, then, we've got to become more
familiar with the 6809E microprocessor. Figure 2 shows its
component parts, at least the ones we'll have access to as
assembly language programmers. In standard industry jar-
gon, this is called the "programming model".
CPU REGISTERS
As you can see from the figure, there are a number of
registers in the cpu. (I'll use the term cpu, or central process-
ing unit, as an equivalent term for the 6809E.) A register is
really just another memory location in the cpu. If registers are
just other memory locations, why not put them in RAM? Like a
lot of things in computers, the explanation for this is historical.
Originally, registers in the cpu operated much faster than
memory, so it was convenient to have high-speed cpu regis-
ters to store intermediate results. Now, the speed difference is
much less, but the 6809E and other microprocessors still
retain a set of registers for handling data.
Registers in the 6809E are either 8 or 1 6 bits long. Every
computer user now knows that a bit is a contraction of "binary
digit" and that it represents on/off or 1/0. Eight bits can hold
00000000 through 11111111, which is equivalent to
through 255 decimal, or $00 through $FF hex. (The "$"
stands for "hexadecimal"). Sixteen-bit registers can hold
through 65,535 decimal or $0000 through $FFFF hex.
The main registers that hold intermediate results are the
A and B registers. The A register (historical basis again)
originally stood for "Accumulator." In early computers, the
accumulator held intermediate results of adds, subtracts, and
other operations. In the 6809E we've got two 8-bit accumula-
tors named A and B, and they serve the same purpose.
Joined together, they represent one 1 6-bit register, called the
"D" register. The A and B registers can be handled either as
two 8-bit registers or one 16-bit register.
The PC, or Program Counter, is a 16-bit register that
points to the next instruction byte. Machine language instruc-
tions in the 6809E are one, two, three, or four bytes long. The
PC contains the address of the next instruction to be exe-
cuted at all times. If we have a machine language program at
$3F00 (decimal 16128) in RAM, for example, the PC would
start off at $3F00 and increment through $3F01,$3F02 4 . . .
as each instruction was executed. Of course, in machine
language we've got "branches and branch to subroutines"
(the equivalents of BASIC'S GOTO, IF. . . THEN GOTO
and GOSUB), so at times the PC gets a new address other
than the next in sequence jammed into it to cause the branch.
There are two Stack Pointer registers, U and S. A "Stack"
is a reserved area of RAM, usually about 100 bytes or so.
Every time a "Branch to Subroutine" occurs (BASIC
GOSUB), the address of the next instruction after the Branch
to Subroutine (in the PC) is saved in the Stack. Each address
from the PC occupies 2 bytes, and the S Stack Pointer is
adjusted to point to the next two bytes of the Stack.
The Stack area, "builds down" in RAM. Every time a
Branch to Subroutine is done, two more address bytes are
saved on the Stack, and the S Stack Pointer is adjusted by
subtracting 2. Of course, every subroutine has a Return From
Subroutine (equivalent to a BASIC RETURN) which retrieves
the address from the Stack, reloads the PC, and allows the
program to continue from the instruction directly after the
Branch to Subroutine.
TRS-80 Microcomputer News, February 1982
In addition to saving subroutine addresses, the Stack
can also be used to temporarily hold data from cpu registers
or other memory locations. The Stack also holds addresses
on interrupts, a subject which we'll discuss in a future
column.
TWO FOR THE PRICE OF ONE
Actually, I lied. (It probably won't be the last time.) There
can be more than one Stack. The S Stack Pointer points to the
Hardware Stack, which is normally reserved for subroutine
addresses, interrupt addresses, and occasional temporary
data. Most microprocessors have only one Stack Pointer; the
6809E, however, has two. The U, or User Stack Pointer, can
be used by the programmer for whatever purpose he wishes.
(Well, almost any purpose). Again, we'll discuss this opera-
tion in future columns.
The X and Y index registers are two 16-bit registers
which can be used in certain indexing address modes in
the 6809E. Indexed addressing allows you to set a pointer to
the start of a table of data, and then very easily access the
data from that point of reference. It sounds like another
subject for a future column, and it is.
The Direct Page is also used in 6809E addressing; it can
be set to point to a "page" of memory. A page is 256 bytes
long. Page starts at RAM location 0, page 1 at location 256,
and so forth.
The Condition Codes hold the results of operations per-
formed in the cpu such as adds, subtracts, compares, and
many others. Its equivalent functions in BASIC are the
IF. . . THEN statements. Instead of saying "IF A = THEN
GOT0 1 000" we say "If the Z(ero) Condition Code is set, then
Branch," or "Branch on Equal to Zero." There are condition
codes for a zero condition, negative result, overflow (number
too large for the A, B, or other registers), carry (like a decimal
carry), and system functions such as interrupts.
And that, in a nutshell, is how the 6809E cpu looks, at
least to a programmer. All machine language operations,
from adding two numbers to implementing a high-speed
game with color graphics, are done by manipulating data in
the registers. Operations such as simple adds, subtracts,
compares, transfers to and from memory, and shifts are
used as building blocks to construct all kinds of complex
operations.
A SOUND PROGRAM (HOPEFULLY)
Let's see how a typical assembly language program
works in the Color Computer, and how it is connected
to BASIC. We'll use the example seen earlier, the SOUND
program.
GENERATING SOUND IN THE COLOR COMPUTER
One way the Color Computer generates sounds is by
doing a "six-bit" digital-to-analog (D to A) conversion. A
six-bit binary value from 000000 to 11 11 11 is transformed
into a voltage from about volts to about 5 volts. The greater
the six-bit value, the greater the voltage. This technique is
used to "synthesize" sine waves for cassette recording, to
create musical tones, to create sound effects, and even to
create voices.
We can use assembly language to output successive
6-bit values to the digital-to-analog converter in the CC and
create our own sounds. Assembly language is great for this
because it's very fast. BASIC just does not have the speed to
output the 6-bit values at a rapid enough rate.
The address $FF20 (6531 2) in the CC is the input to the
analog-to-digital converter. If we store a 6-bit value in that
address, the digital-to-analog converter will convert it to a
voltage level. If we store values at a rapid rate, we'll get a
varying voltage level at the D to A output. Some of the
waveforms we can get are shown in Figure 3.
5 Volts
RANDOM
WAVEFORM
Volts
5 Volts
Volts
5 Volts
SINE WAVE
SQUARE
WAVE
Volts
Figure 3. Digital to Analog Output Waveforms
The output of the D to A can be routed to the TV speaker,
and we can easily hear the results. The SOUND program lets
us experiment with different data rates, different data, and
even repeat the same data for thousands of times. An infinite
number of sound effects (flying saucers, laser blasts,
crashes, buzzes) can be generated just from RAM and ROM
data in memory alone, or you can try your own data.
VARIABLES IN THE SOUND PROGRAM
The SOUND program uses four variables from the BA-
SIC program to generate a sound. The four variables must be
POKEd into locations $3F00 through $3F06 as shown in
Figure 4.
One Byte
Location
$3F00 (16128)
$3F01 (16129)
$3F02 (16130)
$3F03 (16131)
$3F04 (16132)
$3F05 (16133)
$3F06 (16134)
# OF REPEATS +0-65535
0-255
OUTPUT RATE
START
ADDRESS
END
ADDRESS
-0-65535 ($0000- $FFFF)
--0- 65535 ($0000-$FFFF)
Figure 4. SOUND Parameters
The first variable is the number of times the data is to be
repeated. If this is a 1 , the data will be output in one burst to
the D to A. If this variable is a 1 0, ten consecutive bursts will be
done, but because of the speed of machine language, it will
TRS-80 Microcomputer News, February 1982
sound like one long continuous burst. Up to 65,535 bursts
can be done, and this parameter therefore requires two bytes
of storage at $3F00, $3F01 .
The second variable is the output rate. A value of 1 is the
fastest and a value of 255 is the slowest. This variable is
stored by a POKE to location $3F02.
The third and fourth variables are the starting and ending
addresses of the data. These two variables are stored by
POKEs to locations $3F03,$3F04 and locations
$3F05,$3F06. You can put any start and end locations into
the two variables - ROM locations, RAM locations, or your
own data area that has been initialized by POKEs.
THE BASIC DRIVER
Figure 5 shows the BASIC driver, the program that calls
the SOUND assembly language program. Statements 110
through 1 30 contain the machine language code for SOUND
in decimal values of DATA statements. If you look at the first
location of SOUND, you'll see a hex "10BE." Hex 10 is
decimal 1 6 and hex BE is decimal 1 90, and these are the first
two values in the DATA statement in line 110. There are 35
DATA values, each corresponding to a machine language
byte in SOUND.
100 REM BASIC DRIVER FOR AL SOUND
110 DATA 16, 190, 63, 0, 190, 63, 3, 166, 128,
72, 72, 183, 255, 32
120 DATA 141, 12, 31, 16, 179, 63, 5, 38, 240,
49, 63, 38, 233, 57
130 DATA 182, 63, 2, 74, 38, 253, 57
140 FOR I=&H3F07 TO &H3F29
150 READ A
160 POKE I, A
170 NEXT I
180 DEFUSR0=&H3F07
190 POKE &HFF01, (PEEK(&HFF01 ) AND &HF7)
200 POKE &HFF03, (PEEK(&HFF03 ) AND &HF7)
210 POKE &HFF23, (PEEKC&HFF23 ) OR 8)
220 INPUT "# TIMES"; N
230 INPUT "DELAY"; D
240 INPUT "START"; S
250 INPUT "END"; E
260 POKE &H3F00, INT(N/256)
: POKE &H3F01, N-INT(N/256)*256
270 POKE &H3F02, D
280 POKE &H3F03, INT(S/256)
: POKE &H3F04, S-INT(S/256)*256
290 POKE &H3F05, INT(E/256)
: POKE &H3F06, E-INT(E/256 )*256
300 A=USR0(0)
310 GOTO 220
Figure 5. BASIC Driver for SOUND
The first action taken in the BASIC driver is to move the
35 DATA values to locations $3F07 (16135) through $3F29
(16169). The "&H" here is Extended Color BASIC'S prefix
that replaces a "$" used in assembly language. This is done
in BASIC lines 1 40 through 1 70. After this action, the machine
language code for SOUND is now in the $3F07 area. (Use
1 61 35 and 1 61 69 for &H3F07 and &H3F29 for Color BASIC.)
An alternative to this action would have been to assem-
ble SOUND with output to cassette tape. A CLOADM would
then have loaded the machine code of SOUND into this area.
We took the route of including the machine language code as
part of a BASIC program, however, to make it one package, a
common trick.
The statement at line 1 80 defines the machine language
code as starting at location &H3F07 by a DEFUSR0. (Use
"180 POKE 275,63: POKE 276,7" for Color BASIC.)
The next three statements at 1 90 through 21 route the
output of the D to A to the TV audio and turn on the sound.
Locations &HFF01,&HFF03, and &HFF23 are special "hard-
ware" addresses that are dedicated to system functions.
(Use 65281, 65283, and 65315 for Color BASIC.)
Next r the four parameters are input using INPUT state-
ments. The # of repeats, output rate, start address, and end
address are represented by N, D, S, and E, respectively. The
four parameters are stored in locations &H3F00 through
&H3F06 by POKEs in statements 260 through 290. The
POKEs store the repeat count, start, and end as two 8-bit
values; INT(X/256) gets the first (high-order) byte, while
X-INT(X/256)*256 finds the second (low-order) byte. (Use
16128, 16129, 16130, 16131, 16132, 16133, and 16134 for
Color BASIC.)
The USR0 call at line 300 transfers control to the SOUND
routine at &H3F07 BASIC finds the proper address from the
DEFUSR0 address. The A variable and "(0)" are meaning-
less; they are "dummy" variables, but necessary to prevent a
BASIC syntax error. (Use "USR(0)" for Color BASIC.)
SOUND ASSEMBLY LANGUAGE CODE
Look at Figure 1 again and we'll show you what happens
in SOUND.
The LDY $3F00 gets the number of times parameter
from location $3F00 and $3F01 . The 16-bit value is put into
the Y index register. This value will be decreased by 1 each
time through the loop from line 140 through 240.
The LDX $3F03 gets the start address parameter from
locations $3F03 and $3F04. The 1 6-bit value is put into the X
index register. This "pointer" address value will be increased
by 1 for every output to the D to A over the range of data from
start to end address. The ",X + " operand automatically incre-
ments X by 1 each time "LDA ,X + " is executed.
The loop from 150 through 220 outputs data from start to
end address at the output rate specified.
The LDA ,X + gets a byte of data, and aligns it to the form
XXXXXX00, where XXXXXX is the 6 bits of data. The data
value is then output to the D-to-A at hardware address $FF20.
The DELAY subroutine is called right after the output.
DELAY gets the output rate count from location $3F02, and
delays accordingly. It returns to the TFR X,D instruction.
The TFR X,D tests the current address of the data by
subtracting the end address. If they are not equal, the loop
starting at SND020 is executed again. If the start and end
addresses are equal, the RTS returns back to the BASIC
driver at BASIC line 310.
HOW TO USE SOUND
Perform a CLEAR 200, 1 61 27 before entering the BASIC
program of Figure 5. This protects the area from $3F00 on
and prevents BASIC functions from destroying the program
or parameters. Then enter the BASIC program and CSAVE it
on cassette.
Run the BASIC program alone. The SOUND program is
in the form of DATA statements and will be moved to the
$3F07 area. Try various values for N, D, S, and E. A good
area to produce a pure tone is located at 43100 through
43135; this is the "sine wave table" used to produce a
cassette sine wave. Other areas will produce sound effects of
different types.
10 TRS-80 Microcomputer News, February 1982
Fort Worth Scene
WHAT TO DO IF YOU'RE CONFUSED
We've covered an awful lot of ground in this column -
everything from the layout of the 6809E through Color Com-
puter hardware addresses through BASIC interfacing. Don't
feel bad if you don't understand everything presented. The
purpose of this introductory article was to show you a typical
assembly language program that works, that you can have
fun with, and that you can use as a sample for your own study.
The next time we meet in this column I expect you to
have looked over the DEFUSR and USR commands in
BASIC, investigated how the parameters were stored, and
looked up how most of the instructions in SOUND work in a
good book on 6809E programming. (By the way, my
Radio Shack book on Color Computer Assembly Language
Programming will be out shortly.)
Next time we'll be looking at another example of
an assembly language programming, which will show more
of the power of the Color Computer. Until then, keep
assembling!
Editor's Note: William Barden has written several books
for Radio Shack. TRS-80 Assembly Language Programming
is the book he wrote on 1-80 assembly language for the
TRS-80 Model I (also applicable to the Model III).
Fort Worth
I just saw the first printed copies of the December
Microcomputer News. It looks good, but we will continue to
make some modifications over the next few months to en-
hance readability.
WE BLEW IT!
In the September, 1981 issue we published a Cassette
Merge Program for Model I. It does not work as advertised. It
works great in the Model I system I use at home, but does not
seem to work in other systems. So . . . if you have been
having problems getting the program to work in a Model I, we
apologize. If you have been trying to get the program to work
in a Model III, and if your tapes were produced on a
Model III, replace the 66 at the end of line 50 with a 67.
Leonard Scott sent that to us.
Several people have given (or sent) me notes for this
issue, so here are some brief bits of information:
APPLICATION SOFTWARE SOURCEBOOK
February 28th, 1982 is the cut-off date for Volume IV of
the Application Software Sourcebook. If you had a listing in
either volume I or II, you need to renew the listing by Feb. 28 if
you want the listing to appear in Volume IV.
MODEL II SCRIPSIT USERS
If you have been using the 1 .0 version, and you upgrade
to 2.0, the following 2.0 procedure will let SCRIPSIT copy
your 1 .0 files to a 2.0 disk automatically (if you have at least
two drives):
1 . Make BACKUPS of all your 1 .0 diskettes.
2. Place a 2.0 disk in disk drive zero.
3. Place one of the BACKUP 1 .0 diskettes into drive one.
4. Open the first document on drive one, and create User
key 1 as follows:
USER KEYSTROKES
<CTRL>Z 1 C
<ESC> Q
2 C <ENTER>
<ESC>
2 <F2> Y (password)
<ENTER>
2 <ESC> <ESC>
<ESC> 1
<CRTL> Z
5. Press <ESC> 1.
This user key will copy all documents from the 1 .0 disk-
ette in drive one to the 2.0 diskette in drive zero. The key also
(Continued on page 1 8)
DISCUSSION
Begin capturing user key 1
Exit the current document
Copy the first document to drive
zero
Delete the FIRST document on
drive one
Open the NEW first document on
drive one
Restart user key 1
Close the user key capture
TRS-80 Microcomputer News, February 1982 11
CompuServe
Confessions of a Computing
Family
Editor's Note. The CompuServe Information Service is
one of the largest information and entertainment services
available to owners of personal computers and computer
terminals. With each issue of TRS-80 Microcomputer NEWS,
various features of CompuServe will be discussed. The
CompuServe Information Service is sold at Radio Shack
stores nationwide and in Canada.
Fifteen years ago, Al Smith became acquainted— albeit
on a limited basis— with the world of computers and com-
puter language. Call it planning, foresight, or merely happen-
stance, but today Al Smith feels right at home on his TRS-80
computer, whether programming data relating to his insur-
ance business, or accessing the CompuServe Information
Service for the latest New York Times book reviews.
Fifteen years from now, Al Smith might well look back on
this time as the pioneering state of home computer use. Just
as another generation recalls the advent of television— end-
less wrestling matches, Uncle Miltie, everything in living black
and white— the computer users of today may look back on
the late 1970s and early 1980s as a time of innovation,
experimentation and technological discovery.
Although Smith says, "I'm really impressed with the da-
tabase on CompuServe," he qualifies that statement with the
prediction that, "I don't think what we have now is anything
compared to what we'll see in 20 years, or even in five years."
Al Smith, an insurance agent in Columbus, Ohio, pur-
chased his personal computer approximately two years ago.
At the same time, he began subscribing to the CompuServe
Information Service. During the week, he puts the computer
to work in his insurance agency. Evenings and weekends, it
becomes the center of attraction in the Smiths' suburban
split-level home.
The family— Al's wife Ann, 10-year-old Jimmy, 8-year-old
Brent and 3-year-old DeAnn— are suitably impressed with
the system's capabilities, according to Al. "The boys' school
system is now developing computer uses in the schools," he
points out. "Now, the boys are getting an early education
about computers at home. They're not afraid to sit down and
play with it and learn from it." He reports that a favorite
CompuServe feature is games. "Adventure," with its caves
and dragons and assorted beasties, is played most often by
Smith's sons and their friends.
Al Smith admits to "getting on there and playing games
once in a while," but he points out that a real benefit of the
CompuServe Information Service is "being able to trade
information back and forth with other users." He also enjoys
reading the various newspapers available on CompuServe
as well as The Associated Press wire service.
He estimates that the service is used about 15 hours
each month in the Smith household. Its popularity grows in
proportion to the outside temperature decline. "In the winter-
time, this is an especially good activity," Smith notes.
Smith is enthused about the future of home computer
use. "Even now, I'm always pleasantly surprised to run
through the What's New column on CompuServe and find
out the new features that have been added," he says. "And
I'm really looking forward to the day when we'll be able to get
libraries, encyclopedias — you name it."
On CompuServe, Al, that day is closer than you think.
"REFUNDLE BUNDLE" NOW AVAILABLE ON
COMPUSERVE
Refundle Bundle, a clearinghouse for consumer infor-
mation about making and saving money through manufac-
turers refund offers, is now an information provider on the
CompuServe Information Service.
For the veteran refunder and novice alike, Refundle
Bundle offers valuable hints and tips on such topics as what
to save from packages and how to save it, definitions of terms
involved in refunding and descriptions of the various kinds of
refund offers, such as the "form required" versus "no form
required." An interactive section is also available through
which readers can receive answers to specific questions.
CompuServe subscribers can access this information for
the standard fee of $5 per hour weekday evenings, all day
Saturday, Sunday and holidays. Weekday daytime access is
also available. To access the service, a subscriber needs a
personal computer or terminal, a telephone and a modem.
The Refundle Bundle is accessed through main menu item 7,
Home Information, or Go TRB-1.
WELCOME TO REFUNDING
1 to refunding, one of
the feu moneynak ing and
enjoyable hobbies Refunding is
the process of sending in
boxtops, labels, mnerseais.
etc. to a manufacturer and
receiving in return a reward tor.
purchasing the product The
reward could come in three mys
■ you could receive a free product
Ke« (ENTER) for next page
HOW MUCH ARE YOU WORTH?
Determining what your assets and liabilities are is no
easy task to undertake on your own. To be sure, certain
procedures are rather elementary— adding up the worth of
your house, money you have in savings accounts, for in-
12 TRS-80 Microcomputer News, February 1982
stance. In fact, you may think you have a fairly good estimate
of your assets and liabilities.
But wait a minute. Didn't you forget to include the cash in
your individual retirement account? And how about the dia-
mond pendant you inherited from Aunt Bessie? Did you enter
that $750 loan you owe to your brother-in-law under liabili-
ties? Perhaps not. However, such information must be
included for any true accounting of your net worth.
Hmmmm . . . maybe this procedure isn't so simple, at that.
The CompuServe Information Service has the answer,
with a Personal Assets/Liabilities Program. By asking you the
proper questions and recording your monetary answers, the
program offers a precise system for determining your total
assets and liabilities.
The program, of course, operates accurately only with
your help. You, not the computer, must have the financial
facts at hand. You must know the cash value of your life
insurance policy, for instance, and the approximate worth of
that diamond pendant. The program acts as a kind of
"prompter," by listing categories you may not have consid-
ered. The program then totals your net worth by adding up
your responses in various categories and subtracting the
amount of your liabilities.
Of course, the personal financial information that you
enter on the CompuServe Information Service is totally
confidential.
To use the assets/liabilities program, access main menu
item 9, MicroNET Personal Computing, and type R WORTH
after the OK prompt.
Welcome to the CompuServe
sonal Net Horth Program 1
mill be asked for dollar
of your assets and 1 tab 1 1
fit the end of the program
tailed report can be gene
listing assets, habihti
tals and net worth (asset
bilities). If the dollar
of anu. catagory is zero, '
simply press the <ENIER> i
(RETURN) key.
Key <ENTER> to continue
RAYLUX REPORTS: FOR THE INVESTER WHO
EXPLORES ALL OPTIONS
"Explore all options." You've heard such advice before,
and seen the practice in action. A physician, for instance,
examines all possible choices before proceeding with a
course of medical care. A journalist checks reliable sources
before going with a news story. A gourmet chef experiments
with various ingredients until he finds the right combination
for his next out-of-this-world concoction. So, too, should the
savvy investor explore all the options before making financial
decisions. Raylux Reports, a financial information service on
the CompuServe Information Service, is one such option.
The Raylux philosophy is reflected in a paragraph that
appears near the beginning of Raylux Reports on Compu-
Serve: "Raylux is in the business of predicting the future, a
vocation prone to error but essential if we're to navigate the
waters of the future with any confidence. There are many
seers— some more reliable than others— but unfortunately
there is no way to know in advance who'll be right and who
wrong." The Raylux Report stresses the message that it is
vital for investors to educate themselves about facts and
opinions at hand, so that they can make the most informed
financial decisions possible.
To that end, Raylux provides information in five categories:
Business Outlook is a straightforward accounting of cur-
rent economic trends. A recent sample topic, "Mis-
leading Monetary and Employment Indicators,"
discusses the impact of those two variables and incor-
rect conclusions drawn therefrom.
Financial Commentary is a flexible category, perhaps
high lighting one particular investment area. A recent
report on gemstones, tor example, consists of an inter-
view with a noted authority in the gemstone industry, in
a question/answer format.
Stock Market Outlook is a combination historic examina-
tion and preview look at the stock market, and its
"bullish" or "bearish" state.
Securities Glossary is a listing of well-known and lesser-
known securities terms ("Acceptance," "Average
Debt," "Maintenance," "Book Value," for example, is
explored by a simple definition followed by a more
thorough Raylux explanation: "Debt can take many
forms, from unsecured debentures, secured first mort-
gages, bank notes, commercial paper," and so on.
Raylux tells us.
Industrial Outlook Model is a computer program for mak-
ing corporate projections on a 32K microcomputer
system. The model, Raylux says, "simply represents
information for you to consider when making personal
financial decisions." Such a device "is important for
consistency checks or error analyses of the projec-
tions routinely rendered by high-powered securities
analysts and investment advisers," Raylux points out.
The model allows investors to make five-year forecasts
for specific companies, given other assumptions
about profitability, dividend payout policy and other
factors. Investors, with the Raylux model, can predict
what percentage of growth would likely result in the
deterioration or improvement in the company's debt-
to-equity ratio.
Investors all over the country have enthusiastically
adopted Raylux Reports as a valuable investment decision-
making guide. Access Raylux through main menu item 2,
Finance, or Go CIS-34.
OTHER NEW SERVICES ON COMPUSERVE
Three additions have been made to CompuServe's sta-
ble of electronic newspapers.
TRS-80 Microcomputer News, February 1982 13
The St. Louis Post-Dispatch, the Atlanta Journal and
Constitution and the (Framingham, Mass.) Middlesex News
are now offering electronic editions of their news.
The Post-Dispatch offers a wide selection of classified
ads from the St. Louis area, in addition to local and national
news items updated hourly.
The Atlanta newspapers offer information on local airline
flights and local weather as well as their full menu of news.
You can find the newest newspapers, in addition to other
newspapers such as The Washington Post, The New York
Times and the San Francisco Examiner, under main menu
item 1 , Newspapers.
For those of you who would like to share computer
programs you have written with other microcomputerists,
CompuServe now offers an area of our service called
Access. The Access area is designed to be a place where
CompuServe Information Service customers can share pro-
grams and knowledge. The Access area contains a wide
selection of user-contributed programs, games, utilities,
patches and some interesting text files. Go CIS-7 to reach
Access, or type R ACCESS at the OK prompt in MicroNET
Personal Computing, main menu item 9.
Questions and comments about the CompuServe Infor-
mation Service can be sent to Richard A. Baker, editorial
director, CompuServe Information Service, 5000 Arlington
Centre Blvd., P.O. Box 20212, Columbus, Ohio 43220 or
through Feedback, main menu item 5, CompuServe User
Information.
Notes Off The
CompuServe Wire
70715,272- 01 -Oct-81
From Gary E. Snyder
37 Sumner Park
Rochester NY 14616
23:06
The following two liner will turn a Model II with Daisy
Wheel into a conventional typewriter:
10 CLS
: PRINT CHR$(14); 'TURN ON DUAL FUNCTION
20 A$=INPUT$(1)
IF A$=CHR$(1) THEN PRINT CHR$(15)
END ELSE PRINT A$;
GOTO 20 'IF Fl THEN TURN DUAL OFF AND END
Pressing the F1 key will end the simulation. Have fun with
this one . . . Gary
71465,213 - 30-Sep-81 - 19:55
After spending hours trying to send many variables to
my TRS-80 Model II assembly programs, I discovered that
the random disk file buffers are always in the same locations
in memory, regardless of the BASIC program.
Variable file buffer 1 starts at &H6C83 and continues for
255 bytes. In BASIC I load this memory area with the data I
want to send to the assembly program using the LSET and
RSET commands. I can then access the buffer in assembler
with simple mnemonic code instructions. Any data I want to
return to BASIC is put back into the buffer and BASIC can
access the data by using the variables defined in the field
statement.
I thought this might help assembly programmers who
needed to pass more than one value to a USR call.
L.W. Host 71465,213
Computer Clubs
Things have been a little hectic around the Microcompu-
ter News in the last few months, and we have not printed any
information on computer clubs. Here are the names and
contact information for clubs that we have heard about in the
last few months. The clubs are listed alphabetically by state.
FORT SMITH COMPUTER CLUB
Dale Perrymore, Pres.
5820 South Y Street
Fort Smith, AR 72903
(501)452-5362
TRS-80 USERS GROUP OF NAPA
4432 Springwood Drive
Napa, CA 94558
FAIRFIELD COUNTY TRS-80 USERS GROUP
c/o Alan Abrahamson
10 Richlee Road
Norwalk, CT 06851
(203) 866-2670
ASSOCIATION OF PERSONAL COMPUTER USERS
P.O. Box 19427
Washington D.C. 20036
(301) 229-2346
TRS-80 USERS GROUP OF ATLANTA, LTD.
1637 Columbia Drive
Decatur, GA 30034
COMPUTER TIME
ROBERT STUART COMPUTER CLUB
Robert Stuart Junior High School
644 Caswell Avenue, West
Twin Falls, ID 83301
NORTHEAST COMPUTER CLUB
P.O. Box 50252
Indianapolis, IN 46250
LOCAL ORGANIZATION OF COMPUTER OPERATORS
Jamesson's / Radio Shack
U.S. Route 1
Waldoboro, ME 04572
(207)832-4218
14 TRS-80 Microcomputer News, February 1982
MICROCOMPUTER USERS INTERNATIONAL
c/o Jack Decker— newsletter editor
1804 West 18th Street Lot #155
Sault Sainte Marie, Ml 49783
LLIST
91 Valley Street
Rochester, NY 14612
The BASICS
17 North High Street
Fredericktown, OH 43019
(614)494-9002
PORTLAND AREA USER GROUP
P.O. Box 1656
Beaverton, OR 97075
JACKSON AMATEUR COMPUTER SOCIETY
C.B.C.C.
2355 Camp Baker Road
Medford, OR 97501
(503) 535-6883
CAPATUG
Capital Area TRS-80 Users Group
c/o Computerland
4644 Carlisle Pike
Mechanicsburg, PA 17055
WINNIPEG MICRO - 80 USERS GROUP
Mr. Don Wood, President
(204) 452-5978 (evenings)
or
Mr. Don Rigg, Newsletter Editor
(204) 253-9230 (evenings)
188 Dromore Avenue
Winnipeg, Manitoba CANADA R3M 0J3
ASSOCIATION DE MICRO INFOMATIQUE DU
SAGUENAY
a/s LABRI bureau C-405 Pav. princ.
University du Quebec a Chicoutimi
930 est, Jacques Cartier
Chicoutimi, Quebec CANADA G7H 2B1
LP VI
Underline/Boldface
Don Wood
188 Dromore Avenue
Winnipeg, Manitoba CANADA R3M 0J3
Enclosed are a couple of routines I use to obtain true
underlines and bold print on my Line Printer VI.
UNDERLINE
10 INPUT A$
: ' INPUT MESSAGE
20 LPRINT A$;
: ' PRINT MESSAGE
30 LPRINT CHR$( 27 ) ; CHR$ ( 28 )
: ' SET TO 12 LINES / INCH AND PROVIDE LINE
FEED
40 LPRINT STRING$ ( LEN ( A$ ) , 241 )
: ' UNDERLINE MESSAGE
50 LPRINT CHR$ ( 27 ) ; CHR$ ( 54 ) ;
: RESET TO 6 LINES / INCH
BOLDFACE
10 FOR X = 1 TO 2
20 LPRINT "FOR BOLDFACE" ;
: ' PRINT MESSAGE
30 LPRINT CHR$ (27) ; CHR$ (14) ;
: ' SET TO CONDENSED PRINT
40 LPRINT CHR$ (27) ; CHR$ (15) ;
: ' CANCEL CONDENSED PRINT (RETURNS CARRIAGE
TO BEGINNING OF LINE)
50 NEXT X
: ' LOOP TO OVERSTIKE
60 LPRINT
: ' PROVIDE LINE FEED
Microti le Hints
William G.S. Smith
17 Keeler Close
Ridgefield, CT 06877
I have solved a practical problem I was having with
MICROFILES: I have files of information on people. I often want
to print their names first-name-first for mailing lists and other
purposes. But, if I want to alphabetize the list, I must enter
people's names in the stilted last-name-first format. One way
around this problem is to have one field for the last name and
another field for the first name, middle name, etc.
This arrangement allows me to sort on the LAST NAME
field, yet still print the last name at the end of the name where it
belongs. However, this is not an ideal solution. I must leave
enough space in the FIRST NAME field for long first names,
middle initials, titles, etc. This can lead to some pretty strange
looking mailing labels, with huge gaps between first name and
last name because of the unused spaces.
I was confronted with this problem and tried all sorts of
complicated solutions. I wanted normal looking labels, but I also
wanted to sort alphabetically. Then I realized the simple solution;
that I could have my cake and eat it to by having TWO name
fields.
One field is strictly for printing; I type in the full name just the
way I want it to appear: Then, "Dr. & Mrs. Aloysius T. de B.
Bindlestiff, III" and "Mr. Joe Smith" both look normal on the
label . The second name field is for the last name only and is used
for sorting. I also use it when all I need to print is the last name. I
call this field simply "LN" for "last name." It is true that I have to
type the last name twice, but the results are worth it.
The manual does not make it clear that the page break
function will work only if you also use a heading. If you want a
printout that leaves space between the pages you must, there-
fore, include a heading. However, you need not have unwanted
printing at the head of each page. Simply make the heading
consist of a few blanks. That way both you and the program will
be happy.
TRS-80 Microcomputer News, February 1982
15
Computer Customer Service
Questions We Ask You
Our column often includes some of your most frequently
asked or most interesting questions. In today's column we
are going to repeat some of the questions we most frequently
ask customers and share with you why these questions are
really important.
Question 1: Have you got a BACKUP?
Reasons for BACKUPs: BACKUPS are a resource in
case of burglary, fire, employee theft or accident. Remember
that BACKUPS should be done in pairs (program and data) to
help maintain equal wear on your disks. Take a BACKUP
copy of your disks home with you at night. This can help you
recover your information and can help the insurance com-
pany in any claim which might arise.
Accidents that might occur could be caused by hard-
ware or input error. Misalignment of drives, dirt in your drives,
mishandled disks, power surges, or excessive vibrations can
create a "glitch" on your disk. A disk left on a printer can be
wiped out just as easily as if it were bulk erased. Sometimes
an employee is so upset by a problem they have created that
they increase the problem themselves.
If a crashed index (particularly in Accounts Receivable
and Accounts Payable) occurs (usually caused by exiting a
program improperly) it is best to go to BACKUPS. Remember
to exit the program as prompted, for example, "PRESS @ TO
EXIT" means just that. If you get back to the main menu and
then pull the disks out or hit RESET, the index-file will not be
written. If you have noticed that the computer accesses the
disk when you exit, this is when the index-file is being written
to disk.
BACKUPS made frequently and kept updated, save
hours of work and often save having to do a program over
completely.
Question 2: What version of the program do you have?
Reason for asking about version number: Many of our
programs are updated to meet different needs. In some
situations there are new laws or tax changes that require
additional information be kept. This may or may not be part of
your problem or question about a program, but it does tell us
where we are starting from. In many programs the version
number is in the very beginning of the listing, and some
programs incorporate a command for asking for version
number (VisiCalc /V). It would be a good idea to make a
printer copy of the whole program (if it is written in BASIC) by
LLISTing it.
Question 3: What version of TRSDOS are you using with
this program?
The reason for asking about TRSDOS (Tandy
Radio Shack Disk Operating System): different models of
TRS-80s use different TRSDOS versions for different pro-
grams. For Model I business applications programs that
have been converted for use on a Model III, the TRSDOS
should be 1 .2. On the current Model III programs (that did
not require converting), the TRSDOS should be 1 .3. Model I
programs are on 2.3 TRSDOS.
TRSDOS numbers, although similar to program version
numbers, are different in meaning and the numerals do not
reflect the computer model the TRSDOS is associated with or
the newness of the program.
You may also think that we don't want to help you when
you tell us that you're using xDOS. This is not really the case.
We have not tried the program on anything other than the
TRSDOS on which it was released. We can not support all the
operating systems which have been released by other com-
panies. While we are flattered that so many people are sup-
plying both software and hardware for our computers, we are
unable to support anything other than what we sell. We hope
you understand that we'd like to help you, but just can't.
Question 4: Have you made any changes in the program
or are you using it differently then it was intended?
Also, tell us if you have applied a patch to your program,
even if it is one that we have sent to you. It might change the
program slightly. You should also let us know if any other
changes have been made to your program. Tell us also about
any variations or changes in use or programming. We might
not be able to help you if any large changes have been made,
but at least we will be able to tell you right away if a correction
could be made with those changes that are already in the
program. Often we try to solve a problem and, after many
hours of input by many members of our staff, we find
out that a large change or deletion has been made in the
program.
Speaking of staff, the folks here who answer your ques-
tions have spent a great deal of time learning about the
software packages and often have specialized areas of ex-
pertise. Our main goal is to help you as quickly and as
efficiently as possible. As a result, we will not only go to the
best possible source in our department for an answer to an
unusual question, but we will also spend time replicating your
problem if necessary. Sometimes we will ask you to send us
BACKUPS of your disks and copies of your paper work to
help speed up the process or clarify the issue. We appreciate
your help and support in solving your problems.
Now for some final areas where you can help us. If you
have heard from a friend that there is a patch for a program,
don't assume that the patch is necessarily needed in your
copy of the program. Call us and check first. Patches are not
always "preventive medicine".
The worst problems always seem to happen over a
weekend or in the evening when we are not available to
answer your questions. Please take notes on every thing that
is happening and that happened before the problem oc-
curred, note all error messages and their numbers. Write
down in detail what the program did, what the hardware did
and especially what you did.
Check Writer 80
We now have an opportunity to tell you about one of
Radio Shack's newest programs, Check Writer 80™, our an-
16 TRS-80 Microcomputer News, February 1982
swer to "pegboard accounting."
Check Writer 80 is one of our most versatile programs,
with the capacity for storing information on up to nine bank
accounts. The program also has the ability to display that
account information automatically, by just entering the ac-
count number. Check Writer 80 can be an asset for the small
business person and/or the home record keeper.
Check Writer 80 (which is also a check register), main-
tains a file of seventy-five payees and up to thirty expense
codes, and allows the user to determine the "To-Date
Balance" in any of the expense areas.
Payee number codes can be alpha or numeric or a
combination of both. The expense code most frequently
associated with a payee is displayed on the check entry
screen. For instance, for paying checks to the xxxx oil com-
pany you might have created a code for transportation ex-
pense. When you enter the oil company's account number
the display will show not only the name and other payee data
but also the expense code for transportation expense. You
can override the code number, if necessary. You can also
write or record checks for non-regular payees stored in the
system by using 00 for the payee account number. Normally
the payee data will only show if the account number is valid.
In the bank reconciliation section, the bank name will
automatically display after the account number is entered.
There is an entry location for a service charge and for the
ending balance listed on your bank's statement. The reconcil-
iation section allows five fields to be displayed. A "CL" in the
first field denotes each entry which has been previously
cleared, check numbers or a blank for deposits will be in the
second field. The third field will exhibit the payee's name or
the word deposit. The check or deposit date fall into the fourth
field and the check or deposit amount display in the last area.
Checks can be written for amounts as large as nine hundred
ninety-nine thousand, nine hundred ninety-nine dollars and
ninety-nine cents.
When writing checks, the next check number is auto-
generated after the bank account number is entered. You
have the option to print checks with either tractor or friction
feed printers. A sample check for a proper alignment test is
included in your program manual. Your Computer Center or
Radio Shack Store with an expanded computer department
will be able to help you in ordering checks.
This program generates several end of period reports.
After entering your bank(s)' statements, reports can be run.
The general check register bank reconciliation, lists deposits,
checks and ending balances. It lists the name(s) of the
bank(s), the account(s), the last check listed, the closing date
and the ending balance.
The report options on the payees are by name sequence
(you only have to enter the first ten characters) or by ID
number sequence. Other options include an ongoing ex-
pense list as well as a year-end expense report.
We mentioned that Check Writer 80 can be used for your
small business and we are sure that you can think of many
ways it can be an aid for your business as well. One of the
areas where it can be used is for keeping petty cash accounts
separated. Check Writer 80 is a computerized bookkeeper,
giving you truly simplified accounting.
MOST FREQUENTLY ASKED QUESTIONS
Question 1 : How do I tell if the special character set is toggled
in, or if the space compression codes are in use on my
Model III?
Answer: Use the following program to be sure that the special
characters are in use:
10 PRINT @ 0, CHR$(192)
20 IF PEEK(15360)=32 THEN PRINT CHR$(21)
30 CLS
This will print a space if the space compression codes
are active, and a spade if the special character set is
active. It then tests for a space character, and toggles the
special character set on if a space is found.
Question 2: ROUTE was removed from the 1 .3 Model III
operating system. Why?
Answer: The ROUTE command was removed because of
problems encountered with the ROM routines involved.
On occasion, routing will cause loss of data, loss of
program, etc. Some of these errors may even appear to
be serious hardware problems. There were other prob-
lems related to routes which were not logical, but were
possible, such as keyboard to printer or printer to key-
board. This would cause the computer to be looking for
input from the printer or to try to print with the keyboard.
If you are trying to use a serial printer, the only
permanent "fix" for the missing ROUTE is to write a serial
driver program to reside in high memory, similar to the
way LPC works with parallel printers. A temporary fix is to
dump your printer output into a disk file, then use
Model III Scripsit to read the file and output the informa-
tion using Scripsit's serial printer capabilities.
Question 3: I am using several Model I programs on my
Model III which ask me to "SHIFT D" to delete or "SHIFT
I" to insert, etc. I can never make these functions work.
What is wrong with the program, and what can I do?
Answer: There is nothing wrong with the program. You just
need to remember that on a Model I, the shifted charac-
ter is a lower case character (this is without the lower-
case mode and driver, of course.) In order to output the
lower case character on your Model III, you will need to
"SHIFT 0" (to go into lower-case mode), then press the
key indicated. Be sure to "SHIFT 0" again to return to all
caps. Failure to do this will usually cause the program to
"lock up" because most programs are written to reject
the lower-case characters anywhere else.
Question 4: Is there some way to get into low baud in Disk
BASIC on the Model III without having to make the patch
given on Page 12 of the TRSDOS Manual?
Answer: Yes, all you need to do is type in (at the BASIC Ready
prompt, or as a statement in your program) "POKE
1 691 3,0." To return to high baud, type "POKE 1 691 3, 1 ."
You might want to remember that all Model III cassette
data files (created using PRINT#-1) are 500 baud files.
Reading and writing tape files does not change the baud
rate you have set for reading and writing tape program
files.
Question 5: How do you print through the serial port with
SCRIPSIT on the Model III?
Answer: If you are using Disk SCRIPSIT, do a "SETCOM" at
TRSDOS, and set the protocol to match your printer.
Then, when you want to print, type < BREAK) P,S
<ENTER>.
If you have tape SCRIPSIT, you must set your proto-
col using the POKES at 16888, 16889 and 16890 (See
Chapter 8 of your owner's manual). You must then initial-
TRS-80 Microcomputer News, February 1982
17
ize the RS-232-C by executing the following program:
10 POKE 16526,9
20 POKE 16527,0
30 X=USR(0)
You may then load SCRIPSIT in the usual manner,
and print using the < BREAK) P,S < ENTER) sequence.
One word of caution is required here, though. This uses
the ROM drivers, which do not allow for "handshaking,"
so you must use a baud rate low enough to allow the
printer to keep up.
Question 6: 1 use Model III and a serial printer. I use SETCOM
< ENTER) to initialize the RS-232, but my printer doesn't
work. What happened?
Answer: Even though it appears to, Model III TRSDOS does
NOT initialize SETCOM to a set of default values. Each
time TRSDOS is rebooted, you must re-execute a com-
plete SETCOM command, specifying BAUD, WORD,
PARITY, and STOP.
Question 7: Why does "In-Memory Information" not load on
my Model I? The Model III side loads at the store without
a problem.
Answer: The Model I version loads a short program which
must be executed by typing "/ (ENTER)" at the *?
prompt. The rest of the program then loads as a data file
and when the loading is complete, the first screen
appears.
Fort Worth Scene
(From page 1 1 )
Computer Customer Services
Address and Phone Numbers
8AM to 5PM Central Time
Computer Customer Services
400 Atrium, One Tandy Center
Fort Worth, Texas 76102
Model I/III Business Software
Outside Texas 1-800-433-5641
In Texas 1-800-772-5973
Model II Business Software
Outside Texas 1-800-433-5640
In Texas 1-800-772-5972
Education Software
Outside Texas 1-800-433-1679
In Texas 1-800-772-5914
All Other Calls Related to Computers
Outside Texas 1-800-433-1679
In Texas 1-800-772-5914
Switchboard— 1 -81 7-390-3583
DELETES each document from the disk in drive one, so
BACKUPS are very important. Please note that each docu-
ment on the 1 .0 disk must have the same password as every
other document on the disk for this function to work properly.
GENEALOGY:
We have had at least one request for an article on Gene-
alogy Research with Micro's. If you are using your TRS-80 for
Genealogy, you might put together an article for us to publish.
TINY PASCAL:
One of our readers is looking for "short and efficient"
Tiny Pascal subroutines for Log n and Exp. If you have
created useful subroutines for Tiny Pascal, we would like to
publish them for other users.
VISICALC FOR THE COLOR COMPUTER:
VisiCalc will not be available for the Color Computer.
What we have, however, is a similar program on ROM Pak
called Spectaculator (26-31 04). If you are looking for this type
of software, drop by your local Radio Shack store, Spectacu-
lator should be in stock now.
AGRI-BUSINESS PEOPLE:
Have you written an agricultural program for the
TRS-80? If you have, please send your name, address,
phone number, the name of and a brief description of the
program. (Please do not send the program itself).
Radio Shack
Department AX10
One Tandy Center
Fort Worth, Texas 76102
IN CASE YOU HAVEN'T HEARD:
October, 1981 - Tandy Corporation and Matra S.A. of
France have announced that they have signed a definitive
agreement to set up a manufacturing operation in France to
initially manufacture TRS-80 Model III microcomputers. The
agreement is subject to approval of the boards of directors
of both companies and formal approval of the French
government.
October, 1981 - John Roach, President and CEO of
Tandy Corporation, announced that the company will install
and operate its own electronic information database (vi-
deotex) for the Fort Worth/Tarrant County Texas area. The
objectives of the Tandy videotex service will be to provide
subscribers with continuously updated information, on de-
mand, 24 hours a day. A TRS-80 Model II computer and the
newly developed Communications Multiplexer will comprise
the database equipment.
Bruce Elliott— Editor
Linda Miller— Writer
18 TRS-80 Microcomputer News, February 1982
Peripherals
Direct-Connect Modem II
This month I have another new product for you. We
should be shipping the first of the new modem 26-1173,
Direct-Connect Modem II by the end of January. This mo-
dem has many advanced features in a compact unit at a price
that is a real bargain! It is a stand-alone modem which con-
nects directly to the phone line and supports auto-dial and
auto-answer operation.
The modem section is a standard Bell 103J compatible
device. Its baud rate is to 300. Transmit level is - 10dBm.
The receive sensitivity is -40dBm. We had originally speci-
fied a sensitivity of -45 dBm as many other units on the
market boasted of this level. We found in "real world" testing
that this level of sensitivity is too great! At least one major
network system had a ring signal with strong harmonics in the
frequencies used by the modem signaling, producing lots of
confusion! By reducing the sensitivity a little, no degradation
of performance has been observed and the ring response
problem has been eliminated.
D.C. Modem II has four operating modes:
1 . Manual answer
2. Manual originate
3. Auto-Answer
4. Auto-originate
It also includes two test modes. There is a local test which
tests the operation of the unit itself and a remote loopback
which performs test of the total communication link.
In the manual modes the unit operates in the same
manner as the 26-1 1 72 D.C. Modem I (except that it does not
work with the Model I cassette port). For the automatic mode
an on-board microprocessor takes over! There are several
modems on the market which can perform some of the same
functions with a fairly large overhead of software in the host
computer. The microprocessor in the D.C. Modem II is pro-
grammed by simple ASCII commands sent from the host.
The Modem does all the work.
There are 1 2 commands briefly outlined below:
D Dial command - this precedes the number to be dialed.
P Pause - this inserts a two second pause to allow local
systems to access outside lines. They can be cascaded
to allow pauses of any length, i.e. PPPP
C Clear - Clears all registers to default state
L Look - causes the Modem to dump the contents of the user
programmable registers to the host terminal at 300
Baud.
R Rotary Dial - pulse dialing is used
F Fast Dial - selects 20 PPS pulse dial rate
S Slow Dial - selects 10 PPS pulse dialing
T Tone Dial - Dials the number with Bell DTMF tones at 10
digits per second. (By the way, Tone and Pulse dialing
can be intermixed for those of you that live in an area not
supporting tone dialing but who need to access systems
which require tone signalling.)
Q Local Loopback test - same as Local test switch.
O Originate - puts Modem in Auto-Originate mode
X Execute - Follows a command string to cause execution of
the command.
* - An asterisk opens the modem memory for programming.
Here is a typical command string:
* DR435821 4PT64521 8576352X
Any BASIC or machine language program can be used
to send programming information to the modem. In most
cases, the programming code (similar to a driving routine)
can be appended to the front of the communications pro-
gram. The simple commands control a powerful device
opening a new world of possibilities. We are in the processes
of installing a Model III based communications system in
every Radio Shack store in the country for inventory and
accounting uses. The D.C. Modem II is an integral part of the
system, allowing the big Tandem Computer system in Fort
Worth to access the stores in the "dead of the night"!
Direct-Connect
Modem II
Direct-Connect
Modem I
Telephone
Interface II
TRS-80 Microcomputer News, February 1982 19
Model I/III
More PRINT USING
We published an article entitled "Using PRINT USING"
in the August '81 issue of Microcomputer News that has
generated quite a bit of response from readers. I would like to
share with you their comments.
PRINT USING is a valuable Level II or Model III BASIC
statement that comes in handy for screen formatting or report
preparation. With PRINT USING and the addition of PRINT @
as described in the August article it is easy to create profes-
sional looking reports by aligning dollar signs, decimal points
and even controlling the spacing between columns of num-
bers. Even if you don't have that August article handy, PRINT
USING is described in your Model III Operation and BASIC
Reference manual or your Model I Level II Users Manual.
Here are some areas that weren't addressed in that
article but are covered by our readers in the following letters:
1) How can I easily produce multiple column reports?
2) How about using PRINT USING for printers?
3) Finally since a format string can be up to 255 charac-
ters long and can contain any number of line feeds and
literals some advanced PRINT USING techniques are
available.
J. Nelson Phillips
Route 5, Box 69
Shelbyville, TN 37160
The technique shown in the August article is limited in its
usefulness. It does not allow the use of more than one 'PRINT
USING' format on any one print line, for example.
A more elegant solution which allows total flexibility is
shown below:
100 PRINT TAB(M) USING A$
110 PRINT TAB(N) USING B$
120 PRINT TAB(P) USING C$
130 PRINT TAB(Q) USING D$
Note the semi-colon appended to all but the last PRINT
statement. The semi-colons inhibit the CARRIAGE RETURN
at the end of the line. Thus, when the computer executes Line
100, no CARRIAGE RETURN occurs. Then Line 110 is exe-
cuted, with the variable 'X' being printed on the same line and
to the right of 'W'. This continues until a line without the
appended semi-colon is encountered. Then at the end of that
line, a CARRIAGE RETURN occurs, terminating the printing
on that line.
This technique works nicely within a FOR-NEXT loop,
particularly with engineering analysis programs where suc-
ceeding columns of data may require varying PRINT USING
formats.
This technique may require the insertion of semi-colons
preceding 'USING' when a Model I, Level II machine is
employed.
Quincy G. Leslie
SNELLING & SNELLING
401 W Front Street, Suite L-3
Traverse City, Ml 49684
Quite a nice article on "Using PRINT USING" appeared
in your August issue, Volume 3, Issue 8. However, the thrust
of its information seemed oriented to those restricting "PRINT
USING" to CRT screen printing only.
The response to the question of combining the PRINT
TAB(n) statement with PRINT USING was "Do not try "
Still the difficulty remains for those who are programming for
the automatic printing of various forms, for which the LPRINT
statement combining TAB and USING is essential.
LPRINT TAB(n) and LPRINT USING can be combined!
At least on Model Ill's driving Daisy Wheel Printer II's, on
which the following has worked:
140 LPRINT TAB (n) USING E$ ; B
which will print B, with line feed and carriage return.
Multiple columns print with this format:
140 LPRINT TAB(n) USING E$; A;: LPRINT TAB(n)
USING B$;B;: LPRINT TAB(n) USING F$; C
Perceptive readers will note that multiple column print-
outs are really several complete LPRINT statements in the
same program line, separated by ":" 's and incorporating
trailing ";" at the end of each statement to suppress line
feed/carriage return. This feature in effect causes each varia-
ble to be printed in the USING format specified, without any
line feed or carriage return. Therefore, the next variable to be
printed falls on the very same line with the previous
variable(s).
The trailing";" is deleted in the final LPRINT statement to
force the LF/CR.
Earl R. Kooi
2196 Albright Avenue
Upland, CA 91786
Relative to the article on "USING PRINT USING" on
page 6 of the August, 1981 issue of Microcomputer News,
the solution is fine as long as the built-in tab stops fit the
spacing desired. However, if more control over the spacing is
desired, I believe the attached solution is preferable.
This solution works fine on my Model I.
10 CLS
20 FOR K=1000 TO 2000 STEP 100
30 A=K
40 B=A/3
50 C=A/4
60 A$="$$# ,###.##"
70 LPRINTTAB(10)USINGA$;A;
: LPRINTTAB(25)USINGA$;B;
: LPRINTTAB(40)USINGA$;C
80 NEXT
20 TRS-80 Microcomputer News, February 1982
$1,000.00
$333.33
$250.00
$1,100.00
$366.67
$275.00
$1,200.00
$400.00
$300.00
$1,300.00
$433.33
$325.00
$1,400.00
$466.67
$350.00
$1,500.00
$500.00
$375.00
$1,600.00
$533.33
$400.00
$1,700.00
$566.67
$425.00
$1,800.00
$600.00
$450.00
$1,900.00
$633.33
$475.00
$2,000.00
$666.67
$500.00
Johnny Bond
4000 Crestview Drive
Huntsville, AL 35805
ADVANCED PRINT USING
The article on PRINT USING in the August issue of
MICROCOMPUTER NEWS prompted me to share a little
more about the power of PRINT USING. These two short
programs should give the reader some insight as to how far
you can carry a good thing!
In PROGRAM #1 , Line 20, we define S$ with the literal,
"NAME: ", followed by "% %", afield to accommodate a 10
character string, then another literal, "BIRTHDATE:". The first
"##" after "BIRTHDATE; " will accommodate a two digit
month, the "/" will be printed, then a "##" for a two digit day,
another "/" and a two digit year. Lines 30-60 input the neces-
sary information and Line 70 prints it using S$. Now, hold
your breath, RUN it and what you see should vaguely resem-
ble SCREEN #1 . Sure makes line formatting a lot easier, does
it not!
So much for kid stuff, let us go for PAGE formatting!
PROGRAM #2 does basically the same thing except that
Line 20 we add some LINE FEEDs. A LINE FEED is the down
arrow at the left of your keyboard. It will not print either on your
screen or your printer as a down arrow, because it is recog-
nized as a LINE FEED. I have inserted a (4) in the positions
where the LINE FEED should be inserted. There is also some
additional information this time: a literal "TELEPHONE:", with
space for an area code and the local number.
Lines 30 - 90 again input the necessary information. Line
90 accepts the phone number as one single precision num-
ber, and Lines 1 00 and 1 1 divide it into the customary format
for printing, just for the sake of a demonstration. Line 130
prints it all, using the new S$, and the results should look like
SCREEN #2.
Format string (S$ in these programs) can be up to 255
characters long and can contain any number of LINE FEEDS
and literals. The literals may consist of almost all TRS-80
generated characters. If a . (period) is placed between TWO
numeric ("#") fields it will be seen as a decimal point in the
middle of ONE numeric field. A " (double quote) can not be
used for obvious reasons, and for some reason "-" (minus
sign or hyphen) will not print if used between two numeric
fields.
I hope this will help some readers in their programming
as much as it has me.
PROGRAM #1
60 INPUT "DAY OF BIRTH"; DB
70 PRINT USING S$ ; N$ , MB, DB YB
80 PRINT
90 END
SCREEN #1
% J
PROGRAM #2
10 CLS
20 S$ = "NAME: %.
BIRTHDATE : ##/##/## +
TELEPHONE : (###) ###/##«"
30 INPUT "NAME"; N$
40 INPUT "YEAR OF BIRTH (2 DIGITS)"; YB
50 INPUT "MONTH OF BIRTH (NUMBER)"; MB
60 INPUT "DAY OF BIRTH"; DB
70 INPUT "AREA CODE"; AC
80 INPUT "PHONE NUMBER (FORMAT ###»##)"; PN
90 Tl = INT (PN / 10000)
100 T2 = PN - (Tl * 10000)
110 PRINT
120 PRINT USING S$ ; N$ , MB, DB, YB, AC, Tl, T2
130 PRINT
140 END
SCREEN #2
VEAR OF BIRTH (2 DIGITS)? 52
MONTH OF BIRTH (NUHBER)? 4
MV OF BIRTH' 5
AREA CODE' 285
PHONE NUMBER (FORMAT MNflHI)? 9876543
NAME: HflRV
BIRTHDATE: 4/ 5/52
TELEPHONE: (285) 987/6543
10 CLS
20 S$ = "
NAME: X 1 BIRTHDATE: ##/##/##"
30 INPUT
"NAME"; N$
40 INPUT
"YEAR OF BIRTH (2 DIGITS)"; YB
50 INPUT
"MONTH OF BIRTH (NUMBER)"; MB
Model I/III Bugs,
Errors and Fixes
MODEL III TRSDOS (26-312)
The following patches will allow Model III Disk DEBUG
to inspect and/or change addresses in low memory RAM and
ROM (read only):
PATCH *5:0 ( ADD=4EDF , F IND= 38E 6 , CHG=0000 )
PATCH *F:0 ( ADD=4F04 , F IND= DO , CHG= C 9 )
PATCH *5:0 ( ADD=5 06E , F IND=38E 3 , CHG=0000 )
TRS-80 Microcomputer News, February 1982
21
DEBUG has not been fully tested in low memory ad-
dresses and caution should be exercised while using
DEBUG in low memory.
ACCOUNTS RECEIVABLE 26-1555
Model I, Version 3.0 Accounts Receivable prints zero
balance statements.
The problem is corrected by following the steps listed
below:
1 . Backup the diskette(s) and make the changes on the
Backup copy of the program.
2. In BASIC load the program by typing
LOAD "PROCESS" < ENTER)
3. Make the following corrections:
CHANGES (Retype the line or refer to the Edit section of
the owner's manual)
Old Line:
910 IF(CVD(DB$)=0ANDCVI(DH$)=0)OR
ASC(DF$)=7THENRETURNELSEGOSUB1290:AB#=PB:
GOSUB1480:SV$=SV$(ST)
New Line:
910 IF CVD(DB$)=0ORASC(DF$)=7THENRETURN
ELSEGOSUB1290:AB#=PB#:GOSUB1480:SV$=SV$(ST)
NOTE: Prior to 3.0:
Old Line:
1035 IF(CVD(DB$)=0ANDASC(DH$)=0)ORASC(DF$)=7
THEN 11 20
NEW Line:
1035 IFCVD(DB$)=0ORASC(DF$)=7THEN1120
4. Type SAVE "PROCESS" to save program changes.
5. At TRSDOS Ready, make a backup copy of the corrected
diskette.
DISK PAYROLL (26-1556)
In Model I Version 2.0 Disk Payroll, after correction is
made to line 1026 errors are found when adding state tax
tables.
If adding line 1026 causes "PR4RGST" to go over 10
sectors, delete lines 6 through 22 and add this:
6 IN$="" : W$=INKEY$ : WL=0 : PRINTSTRING$ ( FL , 136 )
STRING$(FL,24);
15 FORW=0TO1:PRINTCHR$(W+14);:FORWS=1TO25:
W$=INKEY$:IFW$=""THENNEXTWS,W:G0T0.15
25 PRINTCHR$ ( 14) ; : IFW$="@"THENIN$=W$ : W$=CHR$ ( 13 )
ELSEIFW$>CHR$(31)THEN75
35 IFW$=CHR$ ( 13 )THENPRINTSTRING$ ( FL-WL , 32 )
CHR$ ( 15 ) ; : W=l : WS=25 : NEXTWS , W: RETURN
45 IFW$=CHR$ ( 24 ) THENPRINTSTRING$ ( WL , 24 ) ; : GOT05
55 IFW$OCHR$(8)ORWL=0THEN15ELSEPRINTCHR$(24);
65 IN$=LEFT$ ( IN$ , LEN( IN$ ) -1 ) : WL=WL-1 :
POKE 16418, 136. -G0T015
75 IFFL=WLTHEN15ELSEPRINTW$; : IN$=IN$+W$: WL=WL+1:
IFABS(FL)OlTHEN15ELSEW$=CHR$(13):GOT035
PROFILE (26-1562)
In both Model I and III Version 3.0/3.1 , "Illegal Access
Attempt To Protected File" errors have been reported to
occur when SORTING.
The following patches should be applied to 3.0 and 3.1
PROFILE if you have the Model III computer:
1 . At TRSDOS READY type the patches in with (ENTER)
after each line.
PATCH SORT (ADD=7854,FIND=58160006,CHG=B72805AF)
PATCH SORT (ADD=7858,FIND=05AFCB13,CHG=C63210FC)
PATCH SORT (ADD=785C,FIND=CB1210F9,CHG=5F160000)
If you have a Model 1, you will need to run the following
program with a backup copy of PROFILE 3.0 program disk in
drive 1 .
1 . Load BASIC and type in the following program:
20 F$="":0PEN"R",1,"S0RT"
30 FIELD1,152AS D$,12 AS C$
40 GET 1,2
50 FOR I=1T012
60 READ J:F$=F$+CHR$(J)
70 NEXT
80 LSET C$=F$
90 PUT 1,2
100 CLOSE
110 END
120 DATA 183,40,5,175,198,50,16,252,95,22,0,0
2. Type RUN
3. Use the corrected program disk to continue running PRO-
FILE.
The RANDOM FILE sample in the manual has several
lines that need to be changed so that it will work properly.
When typing in the program the following line changes
should be made.
Old Line:
320 FORI=lT0MD+l:0PEN"I",l
"PRODAT : "+CHR$ (47+1 ) : NEXT1
New Line:
320 0PEN"R" , 1 , "PRODAT : "+CHR$ (47+ 1 ) , RL
Old Line:
340 D=D$LN(J)
New Line:
340 D=D+LN(J)
Old Line:
390 DN=1:F0RI=1T0MD+1:TFN>D(I)THENDN=I+1
New Line:
390 DR=1:F0RI=1T0MD+1:IFN>D(I)THENDR=I+1
Old Line:
400 NEXT:NN=N-D(DN-1):GETDN,NN
New Line:
400 NEXT:NN=N-D(DR-1):GETDR,NN
Old Line:
410 IFASC(R$(1,DN))=192THENPRINT"**DELETE**"
: GOTO460
New Line:
410 IFASC(R$(1,DR))=192THENPRINT"**DELETE**"
: GOTO460
Old Line:
440 PRINT@CU(I)-15374,NM$(I);":";R$(I,DN);
New Line:
440 PRINT@CU(I)-15374,NM$(I) ;":";R$(I,DR);
* * * The remainder of the program should be left as is.
On page 30 of the manual, there is a sample of "USING
SEQUENTIAL ACCESS"
The following lines should be changed:
Old Line:
330 DN=1:F0RJ=1T0NR:IFJ>D(DN)THENDN=DN+1
New Line:
330 DR=1 : F0RJ=1T0NR: IFJ>D(DR)THENDR=DR+1
Old Line:
340 LINEINPUT#DN R$ : IFLEN(R$ )=0THEN340
New Line:
340 LINE INPUT#DR, R$ : IFLEN( R$ )=0THEN340
mLm*
TRS-80 Microcomputer News, February 1982
Old Line:
360 DY ! =VAL(MID$ (R$ , 32 , 6) ) : PD ! =VAL(MID$ (R$ ,32,6))
New Line:
360 DY ! =VAL(MID$ (R$ , 52 , 6) ) : PD ! =VAL(MID$ (R$ , 58 , 6) )
* * * The remainder of the program should be left as is.
RSCOBOL (26-2203)
Currently, when RUNCOBOL (Model I/III) attempts to
CALL an independent segment overlay, it will have a LOAD
FAIL ERROR message and return to TRSDOS. RUNCOBOL
is unable to load and execute the machine language pro-
gram (independent segment). The following patches will cor-
rect this problem (Note: a close parenthesis is not required in
the PATCH command):
PATCH RUNCOBOL/CMD (ADD=9DB8 ,FIND=CD11AEC2419F,
CHG=000000000000
PATCH RUNCOBOL/CMD (ADD=9DC4,FIND=2A,CHG=21 )
PATCH RUNCOBOL/CMD (ADD=AD0D,FIND=19 ,CHG=09)
PATCH RUNCOBOL/CMD (ADD=ACFE ,FIND=D60A,CHG=C318)
PATCH RUNCOBOL/CMD (ADD=AD00 ,FIND=30 ,CHG=9A)
PATCH RUNCOBOL/CMD (ADD=9A18 ,FIND=00000000 ,
CHG=FE0ADA04
PATCH RUNCOBOL/CMD (ADD=9A1C ,FIND=00000000,
CHG=ADD611DA
PATCH RUNCOBOL/CMD (ADD=9A20 ,FIND=00000000 ,
CHG=11ADFE06
PATCH RUNCOBOL/CMD ( ADD=9A24 ,FIND=000000000000 ,
CHG=D211ADC302AD
PATCH RUNCOBOL/CMD (ADD=9B65 ,FIND=2A69AE4E23 ,
CHG=46ED43D1AF
PATCH RUNCOBOL/CMD (ADD=9B6A,FIND=46ED43D1AF ,
CHG=CD8CA8205C
PATCH RUNCOBOL/CMD (ADD=9DCB ,FIND=489F,CHG=D49D)
PATCH RUNCOBOL/CMD (ADD=9860 ,FIND=CD8CA82066 ,
CHG=2A69AE4E23
PRINT to LPRINT
Improved
Al Reudisuelli
Box 6275
Chattanooga, Tn 37401
Please note that the PRINT to LPRINTand the LPRINT to
PRINT conversion techniques which are printed on page 39
of the November '81 issue of the newsletter can cause unex-
pected problems. BASIC statements are stored in memory as
follows:
XX (LSB) : TWO-BYTE ADDRESS OF THE
XX (MSB) : NEXT PROGRAM LINE.
XX (LSB) : LINE NUMBER OF THIS
XX (MSB) : PROGRAM LINE.
XX XX XX ... : PROGRAM TEXT USING TOKENS.
00 : ZERO INDICATES THE END OF THIS LINE.
The series is repeated until the end of the program where
00 00, a pair of hex zeros, tells the BASIC interpreter that
there are no more program lines.
I've coded a small program to demonstrate that the
number 1 78 can occur in a BASIC program more often than
the number of occurrences of the PRINT statement. Recall
that 178 is the token for PRINT.
You must run the program in Level II BASIC for the
numbers to demonstrate the problem, but here's what it boils
down to:
Line 10 has 179 numbers in it along with the REM
command. That means that the starting address of line 20 will
be 17330, and when you convert 17330 into the MSB/LSB
numbers that BASIC uses, it becomes 67 for the MSB and
1 78 for the LSB. VOILA! There's that magic number, 1 78, and
it doesn't refer to a PRINT command at all - it's part of an
address!
Using the technique in the first "PRINT to LPRINT" arti-
cle would change the address and give you funny-looking
results when you tried to LIST the program. As a matter of
fact, you can
POKE PEEK(16548)+256* PEEK(16549), PEEK(16548):
POKE PEEK(16548) + l + 256* PEEKU6549), PEEK(16549)
and make your program list only the first line repeatedly
because in effect, you'll be saying to the LIST function that the
beginning of the next line is at the beginning of the BASIC
program! You can restore the LIST function by POKEing back
the values that were there originally or by deleting that first
line. Try it. It's fun to experiment with and there are more
surprises which I'm not gonna tell y'about.
Now about conversion #2 - Level II BASIC begins at
memory address 17129, and you can prove that by execut-
ing the statement,
PRINT PEEK( 16548) + 256 * PEEK( 16549)
In level II BASIC, those two addresses are the begin-
ning-of-BASIC-program pointer. There is an end-of-BASIC-
program pointer located at addresses 16633 and 16634, so
you can write a program to examine or change memory just
within the limits of your BASIC program. The Conversion #2
program on page 39 of the November '81 Newsletter will
begin looking in memory at a place before the author's BA-
SIC program since he's using Disk BASIC which does not
start at 17129 like Level II BASIC but at a higher address.
Fortunately, he can use the beginning-of-BASIC pointer
to change things from the beginning of his program. The
pointer correctly points to the beginning of the program in
both Level II BASIC and Disk BASIC. Also, the author's
program would scan through all the memory up to address
32767 except that line 65425, as printed, will give a SYNTAX
error since the word "TO" is missing in the FOR/NEXT loop.
The address, 32767, is far below the top of the memory in a
48K machine which is what the author said he's using, so he
might not get all the changes made that he's anticipated.
He could cover the full range of his program if he used
the beginning-of-BASIC-program and end-of-BASIC-pro-
gram pointers. The beginning of the FOR/NEXT statement to
cover the range of the BASIC program would be:
FOR J=PEEK(16548)+256*PEEK( 16549) TO
PEEK( 16633 )+256*PEEK( 16634)
TRS-80 Microcomputer News, February 1982
23
To sum up, both of the conversion routines in the news-
letter may work, but both can cause you problems you may
not have anticipated, and if you didn't back up your program
before you started POKEing around, you could lose parts.
SAMPLE PROGRAM
10 REM1234567891 12345678921 23456789312345678941 234567895 12345
67896123456789712345678981234567899123456789012345678912
345678922345678932345678941234567895123456 78961234567897
1234567898123456789912345678
20 K=PEEK(16548)+256*PEEK( 16549)
30 IF K017129 THEN PRINT "YOU MUST RUN THIS IN LEVEL II
BASIC"
: STOP
40 FOR J=K TO K+20
50 LPRINT PEEK(J);
60 NEXT
John C Miller
110 Riverside Drive, #14C
New York, NY 10024
Both short programs for converting PRINT statements to
LPRINT and vice versa, published in your November 1981
issue, contain three defects. In order of increasing serious-
ness, these defects are:
(1 ) Each revises the entire program, where typically only
a portion should be changed,
(2) both will fail with programs whose program text ex-
tends above location 32767, and
(3) both will often destroy a program in which the byte
being changed (1 75 or 1 78) occurs as part of a line
number or line pointer in the BASIC program. The
programmer normally has no need to be aware of
these values, and may be distressed to find that his
program has been rendered unusable as he inno-
cently attempts to use these routines.
The enclosed routine avoids these problems by prompt-
ing for the range of line numbers in which the changes are
desired, and scanning only those lines. Also, it will not give
illegal function call errors when the text extends into higher
memory. Finally, it corrects only legitimate occurrences of the
desired bytes in the text portion of each BASIC line scanned.
64999 END
65000 DEFSNG Z
65010 Z0=0
: INPUT"MODIFY LINES STARTING AT NUMBER
(DEFAULT=0)"; Z0
65020 Zl=64998
: INPUT "ENDING AT NUMBER (DEFAULT=64998)";
Zl
65030 A$= ,, P"
: INPUT "L=LPRINT (REPLACE PRINT); P=PRINT
(REPLACE LPRINT) (DEFAULT=P)"; A$
65040 N=178+3*(A$="L")
: M=353-N
: REM M=VALUE TO BE REPLACED IF FOUND, N=NEW
VALUE
65050 Z=16548
: GOSUB 65140
: REM INITIALIZE: ZC=L0C OF START OF BASIC
PROGRAM
65060 Z=ZC+2
GOSUB 65140
ZL=ZC
Z=Z-2
GOSUB 65140
REM ZL=CURRENT LINE NUMBER, Z=START LOC OF
CURRENT LINE, ZC=START OF NEXT LINE (OR ZC=0
IF ALREADY FINISHED LAST LINE.)
65070 IF ZC=0 OR ZL>Zl THEN END
65080 IF ZL>=Z0 THEN GOSUB 65100
: REM CALL REPLACEMENT ROUTINE IF LINE
NUMBER IS IN TARGET RANGE
65090 GOTO 65060
65100 FOR Z=Z+4 TO ZC-2
65110 ZW=Z+65536*(Z>32767)
65120 IF PEEK(ZW)=M THEN POKE ZW, N
65130 NEXT
: RETURN
: REM FOR LINE IN LOCATIONS Z THROUGH ZC-1,
REPLACE ALL OCCURRENCES OF BYTE M WITH BYTE
N
65140 ZC=PEEK(Z+65536*(Z>35767)) +
256*PEEK(Z+1+65536*(Z>32766))
65150 RETURN
: REM ZC=CONTENTS OF MEMORY LOCATIONS Z,Z+1
AS A 16-BIT UNSIGNED INTEGER, WHERE Z MAY
EXCEED 32767.
Routine to change PRINT statements to LPRINTand vice
versa.
&, &H and VAL
Bill Dickson
OFFSHORE NAVIGATION, INC.
P.O. Box 23504
New Orleans, LA 70183
If you have a color computer with Extended BASIC or a
Model I, III and Disk BASIC, you may not be aware of a
capability you have. (This also applies to Microsoft's Level III
BASIC).
The two functions '&' and '&H' are used to convert octal
or hexadecimal constants to decimal values. This is a con-
venient feature but if you want to use this function on a
variable within a program, you may be irritated to find that it
won't work!! It is only designed to work with a constant.
Because the information following these statements (&
and &H) is treated as a string constant without quotation
marks, any variable following these statements will be treated
the same (e.g. &HA$) and the result will be garbage.
The key to fooling the interpreter is the VAL function.
Assuming that A$ = "FF", use this statement to convert A$ to
a decimal number.
A = Val ("&H" + A$)
After this statement is executed the variable 'A' will equal
255. Use of the octal function is identical except that you
substitute '&' or '&0' for '&H\ Assuming A$ = "7777"
A = Val ("&" + A$)
After the above statement the variable 'A' will equal
4095.
This may not be a source listing for a high powered
machine language utility, but in the long run may be as useful
if you have a need for this function. None the less I am happy
to contribute to the cause and hope your publication encour-
ages more of the same type of helpful hints and fewer "Space
Invaders".
FORTRAN/BASIC
Data Files
John L. Montgomery
3010 Barcody Road
Huntsville, AL 35802
From time to time I find it necessary to read and write disk
files from both BASIC and FORTRAN. I thought a short
discussion and two demonstration programs might be of
interest to other users of these two languages. I have en-
closed two listings, one of the source code for FORTRAN, the
TRS-80 Microcomputer News, February 1982
other BASIC. These demonstrate how to read and write files
between the two languages.
The technique is really quite straightforward it only re-
quires that you know the precise format of the files that you
want to read and write. The BASIC read of a FORTRAN file is
the same as the reading of a BASIC file except that you must
field the buffer in a manner which represents the way that the
FORTRAN file is written. You need to know what type data
(integer, char, double, etc) and in what order they were writ-
ten. The FORTRAN read of a BASIC file is similar, the main
point is that the read is done unformatted with the data types
specified and positions matched to the BASIC field state-
ment. The unformatted reads and writes in FORTRAN
produce the same conversions as the MKD$ and CVD, etc.
functions in BASIC.
I hope the programs are sufficiently clear to be under-
stood by most people. One more observation —these pro-
grams use the Model I but the lack of user definable record
lengths complicates the process. Also, it is not stated in the
FORTRAN manual, but if you use Formatted disk I/O then the
specified logical record length in the Call Open statement
must be at least one greater than the sum of the Format Field
widths, in the examples the OPEN would have to have been
for a logical record length of 40 or more. In the version for
TRSDOS 1.2 random access to files with logical record
lengths of 256 just did not work correctly, consequently
the programs described above may not work correctly on
TRSDOS 1.2.
FORTRAN PROGRAM
10 C THIS PROGRAM IS TO DEMONSTRATE READING
AND WRITING
11 C FORTRAN AND BASIC COMPATIBLE FILES,
FORTRAN USES THE
12 C
UNFORMATTED READ AND WRITES
13 C
CHARACTER DATA TYPED AS BYTE
30
DOUBLE PRECISION C
40
INTEGER D
50
REAL B
60
BYTE A(25)
70 C
ASK IF READING OR WRITING
80
WRITE ( 1,900)
90 10
READ( 1,910) X
100
IF (X.EQ.l.) GOTO 100
110
IF (X.EQ.2.) GOTO 200
120
GOTO 10
129 C
READ A BASIC FILE AND PRINT DATA TO
SCREEN
130 100
CALL OPEN(6,'BASFILE/DAT' ,39)
140
DO 110 1=1,25
149 C
READ 25 CHARACTERS 1SNGL.1DBL, 1 INT
NUMBERS
150
READ(6,REC=I,ERR=9999)
(A(J)
,J=1,25),B,C,D
159 C
WRITE RESULTS OF DISK READ TO SCREEN
NOTE
FORMAT
160
WRITE(1,1000) (A(J),J=1,25),B,C,D
170 110
CONTINUE
180
GOTO 9999
199 C
WRITE A FORTRAN FILE 25 CHARACTERS F
SINGLE , DOUBLE , INTEGER
200 200
CALL 0PEN(6,'F0RFILE/DAT' ,39)
210
DO 210 1=1,25
220 C
BUILD CHARACTER STRING 25 F'S
230
DO 205 J=l,25
240
A(J)='F'
250 205
CONTINUE
260 C
MAKE UP NUMBERS
270
B=12.*I
280
C=100.*I
290
D=I
300 C
WRITE DATA ON SCREEN
310
WRITE ( 1,1000) (A(J),J=1,25),B,C,D
320
C
WRITE DATA TO DISK 25 CHAR 1 SNGL,
1DBL,
1INT NUMBERS
330
WRITE(6,REC=I,ERR=9999)
(A(J)
,J=1,25),B,C,D
340
210
CONTINUE
520
900
FORMATCIX, 1 SELECT THE OPTION 1-
BASIC
, 2— WRITE FORTRAN',/)
530
910
FORMAT(F6.0)
540
1000
F0RMAT(1X, 25A1, F6.0, F10.0, 12)
550
C
EXIT HERE NORMALLY OR IF ERROR
560
9999
ENDFILE 6
570
END
BASIC PROGRAM
THIS PROGRAM IS TO DEMONSTRATE READING
AND WRITING
FORTRAN AND BASIC COMPATIBLE DISK
FILES
39
1DBL,
BASIC USES DIRECT ACCESS FILES
BYTES LONG
TO ACCOMMODATE A 25 BYTE STRING 1SNGL,
1 INT NUMBER
THE READS AND WRITES ARE THE SAME AS
STANDARD BASIC
10 CLEAR 1000
20 PRINT " SELECT AN OPTION, 1-
READ FORTRAN '*;
: INPUT X
30 IF X=l THEN 100
40 IF X=2 THEN 200
50 GOTO 20
100 OPEN "R", 1, "BASFILE/DAT",
110 FIELD 1, 25 AS E$, 4 AS F$,
120 FOR 1=1 TO 25
WRITE BASIC, 2-
39
8 AS G$, 2
129
AS H$
S 1 SNGL, 1DBL, 1INT
WRITE STRING OF
NUMBER
130 A$=STRING$(25,"B")
B$=MKS$(3.2*l)
C$=MKD$(112*l)
D$=MKI$(I)
140 LSET E$=A$
150 LSET F$=B$
160 LSET G$=C$
170 LSET H$=D$
180 PUT 1, I
190 NEXT
: GOTO 260
199 * READ FILE CREATED BY FORTRAN
200 OPEN "R", 1, "FORFILE/DAT", 39
210 FIELD 1, 25 AS A$, 4 AS B$ , 8 AS C$, 2 AS D$
220 FOR 1=1 TO 25
230 GET 1, I
240 PRINT A$; CVS(B$):
250 NEXT
260 CLOSE
: END
CVD(C$); CVI(D$)
Instant Recall
Dwight Dager
14 Bernard Drive
Morrisville, PA 19067
Instant Recall is a BASIC program designed to test one's
mental recall ability by matching the hidden characters that
are briefly displayed behind 26 lettered blocks. These char-
acters are randomly shuffled after each complete game, thus
insuring a variety of different starting locations.
Up to two players can compete. Starting players are
randomly chosen and will repeat play for every MATCH that
is made. If you have a speaker/amplifier connected to the
cassette port, a single tone will sound after each NO-MATCH.
All inputs are accomplished by pressing the proper let-
TRS-80 Microcomputer News, February 1982
25
tered key. A score is kept with the overall high score updated
after each complete game.
The program will run on a Model I (16K) Level II com-
puter.
Possible modifications:
1 . To change characters, modify line 320. A total of 13
characters must be used.
2. To change the length of time which characters are
displayed, modify TD value in line 1170.
10 '*** INSTANT RECALL ***
20 ' by DWIGHT DAGER
30 ' MORRISVILLE,PA.
50 CLEAR 200
DEFSTR P, L, S, B, G, I
DEFINT X-Z, Q, N, R, M, T,
DIM S(14), B(27), Q(27), N(27), L(27)
90 Gl=STRING$(5, 191)
: G2=STRING$(36, 140)
300 DATA 71, 77, 83, 89, 193, 199, 205, 211, 217,
223, 321, 327, 333, 339
310. DATA 345, 351, 449, 455, 461, 467, 473, 479,
583, 589, 595, 601
320 DATA #, $, %, &, *, +, ?, =, "1", "3", "5",
"7", "9"
330 DATA A, B, C, D, E, F, G, H, I, J, K, L, M,
N, 0, P, Q, R, S, T, U, V, W, X, Y, Z
500 '* PLAYER NAMES *
510 CLS
O(l)=0
O(2)=0
INPUT "HOW MANY PLAYERS - (2 MAX.)"; N
PRINT
PRINT "PLEASE ENTER YOUR NAME (14 LETTERS
MAX.):"
: PRINT
: FOR X=l TO N
520 PRINT "PLAYER #" X;
: INPUT P(X)
530 IF LEN(P(N))>14 THEN PRINT
: PRINT "** 14 LETTERS MAX. **"
: GOTO 520
540 PRINT
: NEXT X
: CLS
605 PRINT CHR$(23)
: PRINT@466, "THINKING"
610 '>PUT PRINT LOCATIONS IN Q()
620 RESTORE
FOR X=l TO 26
READ Z
Q(X)=Z
NEXT X
630 ">PUT SYMBOLS/NUMBERS IN S()
640 FOR X=l TO 13
READ S
S(X)=S
NEXT X
650 '>PUT LETTERS FOR BLOCKS IN I()
660 FOR X=l TO 26
READ L
L(X)=L
NEXT X
670 'RND 2 SETS OF #'S 1-13
680 RANDOM
FOR Z=l TO 26
N(Z)=0
NEXT Z
FOR Z=l TO 26
690 X=RND(13)
700 N(Z)=X
: Y=0
: FOR Zl=l TO 26
710 IF N(Zl)ON(Z) THEN NEXT Zl, Z
: GOTO 740
720 Y=Y+1
: IF Y=>3 THEN N(z)=0
: GOTO 690 ELSE NEXT Zl, Z
730 '>PUT RND SYMBOLS /NUMBERS FROM N( ) INTO B()
VIA S()
740 FOR Z=l TO 26
: B(Z)=S(N(Z))
: NEXT Z
750 '* DRAW BOARD OUTLINE *
760 CLS
FOR Y=0 TO 640 STEP 128
PRINT@Y, G2;
NEXT Y
FOR X=0 TO 72 STEP 12
770 FOR Y=l TO 31
SET(X, Y)
SET(X+1, Y)
NEXT Y, X
780 PRINT@65, Gl;
PRINT@95, Gl;
PRINT@577, Gl;
PRINT@607, Gl;
790 '* PUT LETTERS INTO BLOCKS *
800 FOR X=l TO 26
: PRINT@Q(X)+2, L(X);
: NEXT X
920 '>INITIAL START
930 PRINT@43, "INSTANT RECALL";
: PRINT@103, STRING$(23, 43);
940 PRINT@773, "PLAYERS TRIES MATCHES SCORE
(HIGH SCORE)";
950 Zl=839
FOR Z=l TO N
PRINT@ABS((INT((LEN(P(z)))/2))-Zl), P(z);
Zl=903
NEXT Z
960 IF N=l THEN POKE 16208, 170
ELSE POKE 16208, 170
: POKE 16727, 138
970 ' >SET ALL COUNTERS TO ZERO/RANDOM START
980 FOR Z=l TO 2
R(Z)=0
M(Z)=0
T(Z)=0
NEXT Z
990 RANDOM
: IF N>1 THEN Nl=RND(2) ELSE Nl=l
1000 '* FUN BEGINS *
1010 PRINT@295, "PLAYER:";
: PRINT@ABS(INT((LEN(P(Nl))/2)-310)), P(N1);
1020 ') INPUTS
1030 PRINT@487, "(PRESS KEY ONLY)";
: PRINT@359, "ENTER 1ST LETTER";
1040 I=INKEY$
: IF I<>"" THEN Xl=ASC(l)
: GOTO 1060
1050 POKE 15718, 143
FOR TD=1 TO 50
NEXT TD
POKE 15718, 128
FOR TD=1 TO 10
NEXT TD
GOTO 1040
1060 IF XK65 OR Xl>90 THEN 1040 ELSE Xl=Xl-64
1070 IF Q(X1)=0 THEN 1040 ELSE PRIKT@Q(Xl)+2,
B(X1);
PRINT@Q(X1), CHR$(140);
PRINT@Q(Xl)+4, CHR$(140);
PRINT@423, "ENTER 2ND LETTER";
1080 I=INKEY$
: IF I<>"" THEN X2=ASC(l)
: GOTO 1100
1090 POKE 15782, 143
FOR TD=1 TO 50
NEXT TD
POKE 15782, 128
FOR TD=1 TO 10
NEXT TD
GOTO 1080
1100 IF X2<65 OR X2>90 THEN 1080 ELSE X2=X2-64
1110 IF Q(X2)=0 THEN 1080 ELSE PRINT@Q(X2)+2,
B(X2);
: PRINT@Q(X2), CHR$(140);
26
TRS-80 Microcomputer News, February 1982
PRINT@Q(X2)+4, CHR$(140);
: FOR Y=359 TO 487 STEP 64
1120 PRINT@Y, CHR$(209);
: NEXT Y
: PRINT@167, CHR$(215);
1130 '>MATCH/NO MATCH
1140 IF B(X1)=B(X2) THEN M=l
M(N1)=M(N1)+1
PRINT@616, "*** MATCH ***"; ELSE M=
PRINT@617, "NO - M A T C H" ;
GOSUB 2110
1150 R(N1)=R(N1)+1
: IF M(N1)>0 THEN T(Nl )=(M(N1 )/R(Nl ) )*100
1170 GOSUB 2000
: FOR TD=1 TO 1500
: NEXT TD
1180 IF M=l THEN PRINT(3Q(X1), Gl;
PRINT@Q(X2), Gl;
Q(X1)=0
Q(X2)=0
GOTO 1200
1190 PRINT@Q(X1), CHR$(128);
PRINT@Q(Xl)+4, CHR$(128);
PRINT@Q(Xl)+2, L(X1);
PRINT@Q(X2), CHR$(128);
PRINT@Q(X2)+4, CHR$(128);
PRINT@Q(X2)+2, L(X2);
1200 PRINT@616, CHR$(210);
1210 '>END ?
1220 FOR Y=l TO 26
: IF Q(Y)<>0 THEN 1240 ELSE NEXT Y
1222 FOR Z=l TO N
: IF T(Z)>0(Z) THEN 0(Z)=T(Z)
1226 NEXT Z
: GOSUB 2000
: GOTO 1300
1230 ! >REPEAT PLAYER ?
1240 IF N>1 THEN IF M=l THEN PRINT@167, "SAME
PLAYER PLAYS AGAIN";
: GOTO 1030
1250 ' >ADVANCE PLAYER
1260 IF N>1 THEN IF Nl=l THEN Nl=2 ELSE Nl=l
1270 PRINT'3295, CHR$(215);
: GOTO 1010
1290 ' >NEXT GAME ?
1300 FOR Y=167 TO 615 STEP 64
: PRINT@Y, CHR$(215);
: NEXT Y
1310 PRINT@359, "PRESS ENTER";
: INPUT XX
: CLS
1320 PRINT GHR$(23)
: PRINT
: PRINT "TO PLAY AGAIN PRESS > A
1330 PRINT
. print "TO CHANGE PLAYERS PRESS > C
1340 PRINT@514, "WAITING:";
1350 I=INKEY$
: IF I="A" THEN CLS
: GOTO 605
1360 IF I="C" THEN 510
1370 PRINT§512, CHR$(143);
: FOR TD=1 TO 50
: NEXT TD
: PRINT@512, CHR$(128);
: FOR TD=1 TO 10
: NEXT TD
: GOTO 1350
1990 '* SCORING SUBROUT *
2000 Zl=849
: FOR Z=l TO N
: PRINT@Zl, CHR$(222);
: PRINT@zl, R(Z);
2010 PRINT@Zl+7, M(Z);
; PRINTI5Z1 + 15, T(z);
: PRINT@Zl+25, O(Z);
2020 Zl=913
: NEXT Z
: RETURN
2100
»* SOUND > NO-MATCH SUBROUT *
2110 FOR TD=1 TO 50
OUT 255, 2
OUT 25 5,
NEXT TD
RETURN
Stunt Racer
York Maksik
2055 Center Avenue
Fort Lee, NJ 07024
The instructions for operating this program are enclosed
in the program itself. Stunt Racer is a game in which you
control a car at the bottom of the screen and walls come
speeding down to the car. The object of the game is to speed
your car through as many walls as possible in the time chosen
by the one playing the game.
Please publish this program for your readers as I think
they will enjoy it. Note: If there are any questions or comments
about this program please send them to: York Maksik, 2055
Central Avenue, Fort Lee, N.J., zip code is 07024.
Editors Comment: In the program listing, Mr. Maksik has
used words and numbers to indicate the proper number of
spaces to insert in literals. For instance, in line 10 you will find
the literal"
"7SPACESSTUNT RACER"
You should replace the phrase "7SPACES" with seven
blanks.
PROGRAM LISTING
1 DIM AS (9)
: CLEAR 5000
10 CLS
: PRINT CHR$(23); "7SPACESSTUNT RACER";
20 FOR T=l TO 1000
: NEXT
: CLS
30 INPUT "DO YOU WISH INSTRUCTIONS"; A$
40 IF A$="YES" OR A$="Y" THEN GOSUB 30000
50 INPUT "HOW MANY TIME UNITS DO YOU WANT (25 TO
1000)"; A
60 Al=.9*(A*14)
: PRINT "IF YOU SCORE "; Al; " POINTS YOU
WILL RECEIVE ANOTHER"
70 PRINT A; " TIME UNITS"
FOR Y=l TO 1500
NEXT Y
CLS
80 INPUT "HOW MANY UNITS SHOULD EACH WALL BE (4
TO 8)"; B
90 IF B<4 OR B>8 THEN PRINT "NOT A GOOD NUMBER,
TRY AGAIN"
: GOTO 80
92 INPUT "SKILL LEVEL 1 OR 2"; Q
: IF QOl AND Q<>2 THEN 92
100 CLS
110 FOR X=l TO B
: AQ$=AQ$+CHR$(191)
: NEXT X
114 K$=CHR$(176)+CHR$(188)+CHR$(191)+CHR$(188)+
CHR$(176)
120 A$(1)=AQ$
130 A$(2)="10 SPACES "+AQ$
140 A$(3)="22 SPACES
150 A$(4)="37 SPACES
"+ AQ$
160 A$(5)="40 SPACES
"+AQ$
170 A$(6)="53 SPACES
"+AQ$
'+AQ$
TRS-80 Microcomputer News, February 1982 27
185 B$="63 SPACES
190 FOR T=l TO A
200 A2=RND(6)
202 A3=RND(6)
204 A1$=A$(A3)
210 A$=A$(A2)
2i 1 IF A2 = A3 THEN 202
220 FOR Tl=64 TO 960 STEP 64
221 PRINT130, "TIME = "; T;
: PRINT@50, "SCORE = "; SC ;
: PRINT@25,PQ;
222 PRINTiSTl, A$;
: PRINTI3T1-64, B$;
224 IF Tl+320 <=960 THEN PRINT@Tl+320 , Al$;
: PRINT@Tl+256, B$ ;
225 PRINT@960, B$ ;
226 GOSUB 10000
250 NEXT Tl
260 NEXT T
270 IF A0O1 THEN IF SC>=Al THEN CLS
PRINT CHR$(23); "EXTRA TIME";
FOR YU = 1 TO 1500
NEXT YU
CLS
A0=1
GOTO 190
280 CLS
PRINT "HOPE YOU HAD A GOOD TIME"
PRINT "BYE! ! ! !"
PRINT "YOUR SCORE IS ="; SC+S1
END
10000 FOR W9=l TO Q
X8=X9
PE=PEEK( 14400)
IF PE=32 THEN X9=X9-5 ELSE IF PE=64 THEN
X9=X9+5
10010 IF X9M018 THEN X9=960 ELSE IF X9<960 THEN
X9 = 1018
10020 PRINT0X9, K$;
: IF X80X9 THEN PRINT@X8, "5SPCS";
10021 PQ=PEEK(15360+X9+2-64)
: IF PQ=191 THEN SC=SC+7
: PRINT@X9-64, "******"
10022 NEXT W9
1
RETURN
CLS
: PRINT "THESE ARE THE INSTRUCTIONS FOR
STUNT RACER"
30010 PRINT
: PRINT "THE OBJECT OF THE GAME IS TO STEER
YOUR CAR"
30020 PRINT "(WHICH IS AT THE BOTTOM OF THE
SCREEN), INTO AS MANY WALLS AS POSSIBLE"
30030 PRINT "YOU CAN STEER THE CAR RIGHT WITH THE
RIGHT ARROW AND"
30040 GOSUB 65000
30050 PRINT "YOU CAN STEER THE CAR LEFT WITH THE
LEFT ARROW (NOTE: THERE IS A WRAP AROUND"
30060 PRINT "FEATURE WHICH ALLOWS YOU TO MOVE
FROM THE LEFT SIDE OF THE SCREEN TO THE
RIGHT SIDE AND VICE"
30063 PRINT "VERSA. THIS IS THE SECRET TO WINNING
THIS GAME"
30064 PRINT "YOU WILL BE ASKED A SERIES OF
QUESTIONS"
30070 PRINT "THE FIRST IS HOW LONG (IN TIME
UNITS)"
30080 PRINT "THE GAME SHOULD BE. BETWEEN 25 AND
1000 TIME UNITS"
30090 PRINT "25 UNITS IS ABOUT 7 MINUTES LONG
WHILE 1000 UNITS IS "
30100 PRINT "ABOUT 1 HOUR LONG. A NUMBER WILL
THEN BE DISPLAYED"
30110 PRINT "SHOWING HOW MANY POINTS YOU MUST
ACHIEVE IN ORDER TO"
30120 PRINT "RECEIVE A BONUS ROUND. (YOU CAN ONLY
GET 1 BONUS ROUND)"
30130 GOSUB 65000
30140 PRINT "THE SECOND QUESTION YOU WILL BE
ASKED IS ABOUT HOW MANY"
30150 PRINT "UNITS LONG EACH WALL SHOULD BE
BETWEEN 4 AND 8"
30160 PRINT "8 UNITS IS THIS LONG WHILE
4 UNITS IS THIS LONG "
30170 PRINT "THE THIRD QUESTION RELATES TO THE
SKILL LEVEL"
30180 PRINT "YOU WILL BE ASKED IF YOU WANT LEVEL
1 OR 2. LEVEL 1 IS"
30190 PRINT "THE HARDER OF THE TWO AND YOUR CAR
WILL MOVE SLOWER"
30200 PRINT "ON THIS LEVEL"
30210 PRINT
PRINT "HOPE YOU HAVE FUN"
GOSUB 65000
CLS
RETURN
65000 PRINT "HIT SPACE BAR TO CONTINUE"
65001 IF INKEY$OCHR$(32) THEN 65001 ELSE CLS
: RETURN
65002 END
AUTHOR'S NOTE: This program was originally written
for a TRS-80 Model I or Model III
with 16K of RAM but I think if you
delete the instructions it might run
on a 4K level 2 system instead of
16K level 2 system.
Quick Label
Roy W. MacLean
RADIO SHACK 1016
Capetown Shopping Mall
Route 132
Hyannis, MA 02601
I will share with you one of those programs that is easy
enough to do, but some of us just cannot find the time for.
Have you ever had the need to reproduce labels on a,
repetitive basis, but need only a few? Here is a simple pro-
gram that works on just about any printer. The variables used
are pretty self-explanatory. Spaces enclosed in quotes are
used in lines 1 1 00-1 1 20 to adjust the print head to center the
label. In my line listing, one blank worked in the printer I used.
In lines 1 1 30-1 1 50, 1 used blanks to force line feeds. You may
have to adjust this to your own printer.
There may also come the time when you need just one
label and you are not drawing it from any data base. If that is
the case, then delete 1060-1090 and 1160. This can be
called in very fast from disk and can be used to address
letters in a simple word processing workstation setup.
1000 CLEAR 200
1010 INPUT "NAME "; NA$
1020 IF NA$="00" THEN END
1030 INPUT "ADDRESS "; AD$
1040 INPUT "CITY STATE ZIP "; CT$
1050 CLS
K
INPUT "NUMBER OF LABELS
L$
1070 IF L$=CHR$(13) THE L=l ELSE L=VAL(L$)
1080 REM ****■
1090 FOR T=l
1100 LPRINT
1110 LPRINT
1120 LPRINT
1130 LPRINT
1140 LPRINT
1150 LPRINT
1160 NEXT T
1170 REM ***** END OF LOOP *****
1180 GOTO 1010
START OF LOOP *****
TO L
"; NA$
"; AD$
"; CT$
28
TRS-80 Microcomputer News, February 1982
Education
Essential Math Programs
Microcomputer-based basic skills instruction in mathe-
matics isn't only for the elementary school students, although
Radio Shack's K-8 Math Program has been well-received
and well-publicized. Secondary students too can use the
microcomputer to sharpen their mathematical skills. C.A.I,
(computer assisted instruction) programs can help second-
ary students master addition, subtraction, multiplication, and
division skills, as well as fractions, decimals, percent, and
pre-algebra concepts. C.A.I, can help secondary students
build the foundations they'll need for algebra and other high
school and college math courses.
The Radio Shack Essential Math Program is Radio
Shack's secondary school counterpart to the Radio Shack
K-8 Math Program. The Essential Math Program, Volume
One, is now available through your local Radio Shack Store
or Computer Center. Volume Two will be available soon.
Together, the two volumes provide a wide range of supple-
mentary exercises designed to complement your local sec-
ondary school's math curriculum.
The Essential Math Program, Volume One, consists of
eight computer programs. Each program contains a series of
lessons. One program each is included for Addition, Subtrac-
tion, Multiplication, and Division. Lessons in each of these
programs are sequenced in order of increasing difficulty, with
each lesson building upon skills mastered in the preceding
lesson.
The other four programs in Volume One of the Essential
Math Program provide "Number Concepts" lessons in a
variety of skills. For example, Number Concepts 1 , the first of
the four programs, includes lessons in ordering numbers,
identifying place value, rounding, using expanded notation,
and finding common factors. Other Number Concepts pro-
grams cover topics including prime numbers, exponents,
and square roots.
Volume Two of the Essential Math Program consists of a
total of ten programs in three subject areas: Fractions, Deci-
mals and Percent, and Pre-Algebra concepts. Again, lessons
build upon one another. The first Fractions lesson asks the
student to identify the fraction represented by a diagram on
the screen. Later the student compares and reduces frac-
tions and multiplies, divides, adds, and subtracts fractions
and mixed numbers.
The Decimals and Percent lesson sequence begins with
problems in adding, subtracting, and multiplying decimal
numbers that represent money. Later the student writes deci-
mals as fractions, determines place values in decimal num-
bers, and multiplies, divides, adds, and subtracts decimals.
Percent exercises include converting fractions and decimals
to percents, finding percentages of whole numbers,
and finding particular numbers by knowing percentage
relationships.
Lessons in the Pre-Algebra sequence relate familiar
mathematics concepts to negative numbers and to equations
containing variables.
Now let's take a look at how you can use the two volumes
of Essential Math. We'll use the Fractions 1 program from
Volume Two as an example. As soon as the Fractions 1
program is loaded and running, you'll see the title screen
appear:
THE PLACEMENT MODE
Notice the question "What is your first name?" in the
middle of the screen. If you typed the student's name and
pressed < ENTER) , you could start the student in the lesson
of your choice. Alternatively, you could use the placement
mode to determine where in the lesson sequence a student
should begin. If you select the placement mode, the com-
puter will measure the student's current level of ability and
place him or her in the appropriate lesson for further practice.
To select the placement mode, you'd type < SHIFT) <t>
instead of a name at the question, "What is your first name?" .
You'll then see the question, "DO YOU WANT THE PLACE-
MENT MODE (Y/N)?". Type <Y> for "Yes" and press {EN-
TER). You'd then see the question, "DO YOU WANT
AUTOMATIC PROMOTION AND DEMOTION (Y/N)?". You'd
type < N > for "No" and press < ENTER) . (When setting up for
the placement mode, you do not need this feature.) Next the
question "WHAT LESSON NUMBER?" appears:
TRS-80 Microcomputer News, February 1982 29
The Fractions 1 program contains ten lessons: review
lessons R1 through R5, and lessons numbered 65 through
69. (The entire Fractions lesson sequence contains thirty-one
lessons). If you don't know the student's ability in fractions,
you can start him or her with the first lesson in a program in
order to avoid the discouragement of too many demotions.
(Lesson content summaries are included in each volume
to help you make such decisions.) To choose lesson R1,
you would type <R><1> at this point, and press < ENTER).
Then you would see the message, "THE TIME-OUT IS 30
SECONDS. HOW MANY SECONDS?":
For lesson R1 , the computer will normally allow the student
30 seconds to answer the problem before the word "TIME" is
displayed on the screen. (The "TIME" message is used to
encourage quick thinking, and is not considered in evaluat-
ing the student's response. The student can go on to answer
the question after "TIME" is displayed.) If you wanted to
change the number of seconds, you'd type in the new num-
ber of seconds and press < ENTER). If you decided to leave
the time-out as it is, you'd simply press < ENTER).
Next you'd see the message, "THE NUMBER OF
PROBLEMS IS 30. HOW MANY PROBLEMS?":
This message tells you that the computer will normally
present 30 problems from lesson R1 when the lesson is run. If
you wanted to change the number of problems, you could
type in the desired number and press < ENTER) . To leave the
number of problems at 30, you'd simply press < ENTER).
When you are setting up for the placement mode, it should be
sufficient to have the student work just a few problems from
each lesson. You might, for example, type <5> at this point
and press < ENTER).
Once you have changed the number of problems, you
are finished setting up for the placement mode and are ready
for the student to begin working with the computer. At this
point, the title screen reappears, with the question, "What is
your first name?":
When the teacher or student types in the student's first name
and presses < ENTER), the first problem appears on the
screen. An almost infinite number of different problems can
be presented in a given lesson, since the computer gener-
ates problems randomly according to a set of rules for each
lesson's content:
To work this problem, the student types in the fraction that he
or she thinks the diagram represents. First the numerator,
then the denominator, is typed in. If the student answers
correctly, a positive reinforcement message such as "GOOD
JOB!" may appear, and a new problem will be presented. If
the student enters an incorrect numerator or denominator, a
"PLEASE TRY AGAIN" message is displayed. If the student
twice enters an incorrect numerator or denominator, the cor-
rect answer is displayed, and the student must type the
correct answer in order to continue. Once the entire problem
is completed, the program moves on to the next problem.
In the placement mode if the student answers the five
problems from lesson R1 with a score of 90% or above, the
computer will present five problems from lesson R2. The
computer will continue to promote the student until the stu-
dent scores less that 90% on a set of problems from a given
lesson. (If the student starts with a lesson other than the first
lesson of the program and scores less than 70% on the first
set of problems, the computer will demote the student until he
or she scores above 70% on a set of problems from a given
lesson.) Once placement is made, a placement report
appears:
30 TRS-80 Microcomputer News, February 1982
YOUR PLACEMENT IS COMPLETE.
VOU'VE BEEN PLACED AT LESSON R3
ENTER CODE TO CONTINUE.
PROMOTION AND DEMOTION (Y/N)?" and typing <N> for
"No." (This feature is not in effect during the placement
mode, but will be in effect if the student takes a skill building
lesson after placement has been made.)
Automatic promotion and demotion allows a student to
progress forward or backward in a lesson sequence after
placement has been made. At the end of each skill building
lesson, the computer recommends the next lesson based
upon the student's performance on the lesson just taken.
For example:
To allow the student to work skill-building problems in the
lesson in which he or she is placed, simply press (SHIFT)
<S> when a placement report is on the screen. Alternatively,
you could press < SHIFT) <T> to end the program, and then
type <R)<U)<N> < ENTER) to start the program over and
place another student.
THE SKILL BUILDING MODE
If you choose to press <SHIFT> <S> when a placement
report is on the screen, the computer will present a lesson at
the level at which the student has been placed. The computer
will present as many problems as are usually given for that
lesson (remember thatfor lesson R1 , the usual number is 30).
If you want to change the number of problems in a skill
building lesson, you can start the program over and change
the number of problems per lesson when you see the ques-
tion "HOW MANY PROBLEMS?".
After the student finishes a skill building lesson, a report
similar to the following will appear on the screen:
RADIO SHACK
COMPUTER ASSISTED INSTRUCTION
NUMBER CONCEPTS 1
REPORT FOR DENNIS
LESSON R3
PROBLEMS COMPLETED 30
PROBLEMS CORRECT 28
PERCENT CORRECT 93y.
RECOMMENDED LESSON
FOR NEXT SESSION: R4
ANOTHER LESSON NOW. <V/N)?
In this example, if the student presses <Y> to take another
lesson the computer will present the recommended lesson
(lesson R4). If automatic promotion and demotion had not
been in effect, the student would simply repeat lesson R3
regardless of his or her performance on lesson R3. With
automatic promotion and demotion, a student can work his or
her way through all of the lessons in a program by moving
forward one lesson each time he or she demonstrates mas-
tery of the lesson just taken.
RADIO SHACK
COMPUTER ASSISTED INSTRUCTION
NUMBER CONCEPTS 1
REPORT FOR DENNIS
LESSON R3
PROBLEMS COMPLETED 38
PROBLEMS CORRECT 28
PERCENT CORRECT 93%
ANOTHER LESSON NOW <V/N)'
Information from this report can be recorded on a Stu-
dent Record Sheet for the student. A sample student record
sheet and blank student record sheets for you to photocopy
are included with each volume of the Radio Shack Essential
Math Program.
When the skill building report is being displayed, you can
press <Y> to take another lesson, type <N> to return to the
title screen, or type < SHIFT) <T> to end the program.
AUTOMATIC PROMOTION AND DEMOTION
The promotion and demotion feature is automatically
in effect if you start a student in a skill building lesson without
first viewing the question "DO YOU WANT AUTOMATIC
DEVELOPMENT OF THE ESSENTIAL MATH PROGRAM
The Radio Shack Essential Math Program, Volumes One
and Two, grew out of a computer assisted instruction project
that curriculum designer Dr. Max Jerman was working on at
Stanford in the mid 1 960s. Since then, the program has gone
through many developmental stages, and has been updated
in structure and content to fit the current basal mathematics
textbooks.
Dr. Jerman has used the program to teach all types of
secondary students, and he estimates that in development
the program gave a total of one million lessons to ten thou-
sand students. Dr. Jerman has also used the program for
demonstration purposes in teaching math education classes
at the college level, and he reports that a junior college in
his area is using one version of the program in its remedial
math classes.
The program takes advantage of the individualization of
instruction and the immediacy that microcomputer-based
instruction can provide. Through positive reinforcement mes-
sages, an immediate sense of achievement is given to the
student when he or she does well. The student can see his or
her progress through the lessons and may be motivated by
the fact that these milestones are so tangible.
Immediacy also helps the student who is having trouble
with lesson material. The program corrects mistakes immedi-
ately rather than allowing the student unknowingly to rein-
force errors while completing an assignment and waiting for
TRS-80 Microcomputer News, February 1982
31
feedback. Students are given corrections while they are still in
the midst of problem-solving thought processes. Because
classroom use of computer assisted instruction materials can
save time for the teacher, the teacher can often give extra
help to students who do not understand a lesson.
Finally, a program like Volumes One and Two of Essential
Math allows almost every student to experience success. The
automatic promotion and demotion feature will place most
students in a lesson in which they can solve at least 70% of
the problems correctly. Even if the student is not promoted
immediately, he or she will see positive reinforcement mes-
sages for individual problems which are worked correctly.
Through the intensive practice provided by each Essential
Math lesson, most students will eventually score 90% or
above on the lesson and will be promoted.
WHO USES THE RADIO SHACK ESSENTIAL MATH
PROGRAM?
David Long, the administrator in charge of special pro-
jects at Mount Airy City Schools in Mount Airy, North Carolina,
reports that his district has had success using both the Essen-
tial Math Program, Volume One, and the K-8 Math Program.
This year the district set up three microcomputer centers,
each containing a Radio Shack Network System with seven
or eight student stations. Each one of the district's three
school building complexes has its own center.
The center that serves the district's junior high and high
school complex was used almost exclusively by Title I excep-
tional students throughout the first quarter of this school year.
Students met in the center daily or on alternate days for math
practice sessions with Essential Math and K-8 Math.
According to Long, the Title I students were able to make
acceptable math grades during the time that they were work-
ing regularly with the computers. In the second term, how-
ever, the Title I students had less time to work with the math
programs because other students were using the computers
and because of other scheduling problems. Long reports
that Title I math grades were down in the second semester,
and he sees the lower grades as a result of less time spent
with the math practice programs.
Long identifies the motivational approach of these Math
practice programs as a strong point, and commented that the
computer provided a "constant stimulus." Because students
quickly got used to following the pointer symbol or cursor,
they learned to "attack the problem in the correct manner." Jn
this aspect, Long said, a computer program does more than
a workbook, because the computer shows students how to
solve the problem step by step.
The technicians who operate the district's three centers
were hired by the district and then trained through the free
computer courses for educators that are available at
Radio Shack Computer Centers. Long also credits Gerald
Moore, the educator at their local Radio Shack Computer
Center in Winston-Salem, with being especially helpful. Long
says, "Our main reason for going with Radio Shack was the
service, which has been excellent."
Steve Drosdek, who teaches math and computer pro-
gramming at Eagle Valley High School in Gypsum, Colorado,
has recently started using Volume One of the Essential Math
Program to reinforce students' basic math skills. Drosdek
expressed concern that many students come to high school
without having had the opportunity to sit down and work math
exercises on paper with "enough repetition to master basic
facts." He is very pleased with the Essential Math Program so
far, and thinks it can help students "really develop basic
skills" by "giving the practice that is necessary."
Drosdek has also used Essential Math's placement
mode as a diagnostic tool to supplement the usual standar-
dized tests. He has found the placement mode helpful in
highlighting specific skills problems.
Students using Essential Math regularly take lessons in
Eagle Valley's computer room, where they work intensively
on problems from one Essential Math segment at a time-
Addition, Subtraction, Multiplication, or Division. Drosdek
says that students who do not enjoy doing math worksheets
are motivated by the computer. And the response from some
students who tend to be "nervous about new things" has
included comments like "boy, that was fun!"
Eagle Valley's TRS-80 microcomputers are also used by
Drosdek's programming students. One of Drosdek's objec-
tives for the year is to extend microcomputer use to more
classrooms, including using the SCRIPSIT® word proc-
essing program in high school business classes.
HOW YOU CAN USE THE ESSENTIAL MATH PROGRAM
The Radio Shack Essential Math Program can be used in
the classroom or in the home to build secondary math skills.
The program runs on a minimum TRS-80 Model III or
Model 1 16K tape or 32K disk system. Essential Math is also
an ideal program for use with a Radio Shack Network 2
Controller.
Using the Controller, a teacher can load a program into a
central disk-based TRS-80 Model III or Model I, and then
send the program through the network to as many as sixteen
cassette- based TRS-80s. This gives the classroom the in-
creased efficiency of the disk system at low cost. The teacher
can use the Network Controller to load one program into all of
the student computers at once or to load different programs
into different computers. The ability to load several or all of the
student computers simultaneously can be a great time-saver.
The suggested price of the Essential Math Program,
Volume One (catalog number 26-1716) is $199.00. Volume
Two (catalog number 26-1 71 9) is sold separately at $1 99.00.
Prices may vary at individual stores and retailers.
Because the two volumes of Essential Math do not em-
ploy a one-lesson-per-program approach, you may be able
to use a single program, once loaded, with a large number of
students.
The Essential Math Program, Volume One, is available
through any Radio Shack store or Computer Center. Volume
Two will be available soon. Also, Radio Shack has Regional
Educational Sales Coordinators throughout the country to
help schools determine and meet their educational comput-
ing needs. For details, call your local Radio Shack store or
Computer Center.
32 TRS-80 Microcomputer News, February 1982
Line Printer VI
Control Program
H. Richard Priesmeyer
2040 Lisa Lane
Fayetteville, AR 72701
It is a simple but useful adaptation of the software control
commands for the Line Printer VI and allows you to easily
select any of four character sizes and 3 pitch spacings. I have
loaded it onto my SCRIPSIT disk and use it frequently when
developing promotional materials.
One interesting note. Item number 4 on the menu cre-
ates characters which are not mentioned in the manuals. Try it
and see. Use the test routine (item number 8) to review the
different combinations of characters and pitch spacings
available.
100 CLS
: PRINT "LINE PRINTER CONTROL PROGRAM"
110 PRINT "LINEPRINTER VI"
112 PRINT "
115 PRINT "CHARACTER SIZE OPTIONS"
120 PRINT " (1) Expanded Characters"
(2) Condensed Characters"
(3) Normal Characters"
(4) Expanded/Condensed Characters"
130 PRINT "
140 PRINT "
142 PRINT "
: PRINT
145 PRINT "LINE PITCH OPTIONS"
150 PRINT " (5) 12 Line/inch pitch"
(6) 8 Line/inch pitch"
(7) 6 Line/inch pitch"
(8) TEST ROUTINE"
160 PRINT
170 PRINT
175 PRINT
180 PRINT "
190 INPUT "ENTER SELECTION"; A
200 ON A GOTO 300, 350, 400, 560, 450, 500, 550,
CHR$(15); CHR$(31)
CHR$(27); CHR$(14)
CHR$(27); CHR$(15)
CHR$(28)
CHR$(56)
CHR$(54)
CHR$(15); CHR$(31)
300 LPRINT CHR$(27)
: GOTO 100
350 LPRINT CHR$(30)
: GOTO 100
400 LPRINT CHR$(30)
: GOTO 100
450 LPRINT CHR$(27)
: GOTO 100
500 LPRINT CHR$(27)
: GOTO 100
550 LPRINT CHR$(27)
: GOTO 100
560 LPRINT CHR$(27)
: LPRINT CHR$(27); CHR$(14)
: GOTO 100
600 FOR N=l TO 5
LPRINT "THIS IS a test."
NEXT
GOTO 100
Print Videotex Material
Jorge Mir
12851 W. Balboa Drive
New Berlin, Wl 53151
I have outlined some simple procedures and written a
short program to enable Color Computer users to print data
gathered while using Videotex. You may want to publish
these procedures and program in a future Newsletter.
VIDEOTEX/PRINT
By JORGE MIR
The procedures outlined below will enable you to get out
of the Color Computer Tape Videotex program without hav-
ing to turn the machine off. (Editor's Comment: Videotex for
the CC was released first on tape. We now supply the same
program in a Program Pak. Mr. Mir's procedure is only appli-
cable to the tape version.) In addition, a short BASIC program
is included to enable you to view the videotex pages stored in
memory and select any of them for printing on a TRS-80 Line
Printer VII.
First, you need to change the videotex program so that
you can press the 'reset' button on back of the color com-
puter to return to BASIC without turning the machine off.
Load the Videotex program the normal way (i.e.,
'CLOADM'). Do not type 'EXEC at this time. Instead, type
the following:
FOR X=2102 TO 2110:POKE X,18:NEXr
The above procedure causes 'NO OP' codes to be
inserted in the section of videotex that causes the machine to
return to videotex after pressing the reset button. Now, the
machine will return to BASIC instead.
At this point, you are now ready to run videotex. You start
the program by typing 'EXEC. When you have stored any
information you want from the HOST computer, go 'offline' in
the normal manner.
Once you are offline, you can print any of the pages still
contained in memory (last 26 pages on a 1 6K system, last 4 if
using a 4K system). You can search through memory by
using the 'up' and 'down' arrows to view those pages which
are still stored in memory.
If, after viewing those pages still in memory, you decide
you want hard copies made, then press the reset button to
return to BASIC. If you have Extended BASIC, you should
type 'PCLEAR1' to enable you to load BASIC programs at
the beginning of RAM. You should also disconnect the mo-
dem RS-232 cable and connect your printer to the serial port.
Once the machine is back to BASIC, you can load the
'V/PRINT' program shown at the end of these procedures.
Load the program and type 'RUN'.
The program causes the pages stored in memory to be
poked into the video screen, one at a time. To go to the next
page, just press the < SPACE BAR) key.
Once you find a page which you wish printed, press the
'P' key and the printer will then print what is shown on the
video screen.
Please note that if the memory area you are viewing does
not contain any videotex pages, then the program will print
some funny things on the screen. What you will see is pure
garbage which is placed in memory when the computer is
first turned on.
If you want to see what the programs stored in memory
look like, then change line 20 in the program to 'FOR
X = 1536 TO 16383' (or 4095 for a 4K system).
You will not be able to go back to videotex at this point
since, most likely, some of the pages stored in memory will
have wiped out part of the videotex program. So, to go back
to videotex, you must reload the program and follow the
procedures outlined above to enable you to go back to
BASIC when pressing the 'RESET' button.
Here is the program that enables you to print those
videotex pages still stored in memory. (Continued on page 38)
TRS-80 Microcomputer News, February 1982
33
Model II
Model II Hard Disk System
Using Radio Shack Application Programs With the HD System
I am getting numerous phone calls from the field about
several key features on the 26-4150 Hard Disk. I will try to
cover at least some of the questions.
First, what software will run or not run? Nearly all of the
programs will run as they are. A few require minor changes to
a BASIC module (3-4 line) or a patch to a machine language
module.
A good example is Profile-II. Existing Profile data bases
can be moved to the hard disk and will operate fine, the
problem shows up when you try to create a NEW data set.
The "DEFINE FILE" module asks which drive you wish to
place the data on but will not accept "4" for an answer. A one
byte patch fixes this.
Some of our programs have hard coded drive numbers
for speed of data handling. Before these programs can be
run, you will have to issue a "FLOPPY OFF" command from
TRSDOS-H D. This tells the operating system to disregard any
hard coded drive numbers and use the first drive that it finds
containing the filename it needs or which is available
for creating a new file. With a single hard disk, this would be
drive 4.
Most of our programs fit into the above categories. The
throughput of the programs will increase from 2 to 12 times
and the capacities of the programs increase drastically. How-
ever, four programs will not change their capacities because
they are using an internal memory index or a limiting counter
set to a hard number. These programs are:
26-4501 General Ledger
26-4502 Inventory Management
26-4505 Accounts Payable
26-4507 Mailing List-II
Four programs will be re-released because of needing
more than just a few patches to make them operate on both
hard disk and floppy. These will be available shortly as a
no-charge replacement for users that need to move the pro-
gram to hard disk. There will be no enhancements made to
the program other than making it operate on the hard disk.
These programs are:
26-4710 Program Editor
26-4714 ReformaTTer
26-4715 Bisync3270
26-4716 Bisync3780
One program (26-4602 Inventory-Multi drive) will be re-
leased in 2 versions. The original version uses 4 floppies to
handle up to 9000 inventory items, and a rework of the
original program (no catalog number yet) to take full advan-
tage of the hard disk would handle (I'm told) about 57,000
items if you wanted to dedicate most of the hard disk storage
to it.
And SCRIPSIT 2.0??? A version will be released with a
new catalog number as a hard disk only version. Much of the
speed of SCRIPSIT 2.0 is due to the fact that all available
memory was used including some that is needed by the hard
disk system. The new version will have a few overlays that will
be called in only as needed by the user. This should not cause
a noticeable delay from hard disk but would have caused
very noticeable delays if done from a floppy.
How about the SCRIPSIT dictionary? Well, as soon as
SCRIPSIT HD is completed, we'll know. It should cause no
problems. The only module that is known to need a change is
INSTALL, and a patch should correct it. If a new version IS
needed, it will be done. The Dictionary is a disk I/O intensive
program and should really whiz on the hard disk system.
The next item I get a lot of questions about is Hard Disk
BACKUP. Hard Disk BACKUP uses two new utilities that were
added to the TRSDOS operating system called "SAVE" and
"RESTORE".
SAVE writes to a floppy in a special (extended density)
format and is much faster than the standard floppy backup.
Standard floppy format takes about 3 minutes and backup
from one floppy to another takes another 8V2 minutes for a
total of about 1 1 V2 minutes for 460K. The SAVE utility writes
the track and data in one pass then verifies it. Each full disk
takes only 2 1 / 2 minutes to SAVE 660K. That amounts to 30
percent more data per disk and about Vs of the time. Saving
5 megabytes of data will only take eight floppy diskettes and
20 minutes.
The SAVE command can also be passed parameters
that will cut down on the amount of data needing to be
backed up. With the options, you may save only data that has
been created after a certain date or data that has been
updated since a certain date. Using the BUILD utility, you
may create a file of filenames to be SAVEd. Since you also
have full wildcarding, you can SAVE only filenames that begin
with ABC or end with a particular extension like /BAS or /DAT.
RESTORE operates about the same way and with the
same speed as SAVE. Even if you have SAVED an entire 5 to
6 megabytes of your system, you may only need to restore
filenames with a specific extension or creation date. As each
disk is created by SAVE, it is assigned a volume number and
an ID. RESTORE will prompt you for the correct volume of the
disk set needed and will verify that it is correct.
That's about it for now, by the time this is printed, you
should be able to drop by any of the Radio Shack Computer
Centers and enjoy HANDS ON experience with the hard
disk unit.
OQ
34
TRS-80 Microcomputer News, February 1982
Model II Bugs,
Errors and Fixes
PROFILE II (26-4512)
It's been reported that Profile II (Version 1 .0) glpesn't
work properly with a serial printer.
To correct this problem, follow these steps:
1 . At TRSDOS READY apply the following patches to a
backup copy of your Profile II diskette.
PATCH CLERK/EFC A=3411, F=3E64, C=3E7E
F=0664,
F=0665,
F=0664,
F=0665,
PATCH CLERK/EFC A=5D66, F=0E00,
* * * After applying these patches, you should be able to
use a serial printer with Profile II.
It has been discovered that SCRIPSIT will not format text
correctly when a large outline format is used.
For example:
PATCH CLERK/EFC A=4F11,
PATCH CLERK/EFC A=4F20,
PATCH CLERK/EFC A=56BC,
PATCH CLERK/EFC A=56C3,
C=067E
C=067D
C=067E
C=067D
C=0E42
SCRIPSIT VERSION 1.0 (26-4530)
To circumvent widow line handling during repagination
SCRIPSIT version 1.0. Follow these steps:
1 . Reset the system at swap diskettes.
2. Answer the Date Prompt, press < ENTER).
3. Press <HOLD> and then press < ENTER) for the Time
Prompt.
4. Type in the following patch:
PATCH SCRIPSIT/6 A=E3B3 F=C5 C=C9
5. Type STARTUP and press < ENTER).
6. SCRIPSIT is now patched and you can continue
operation.
7. Make a copy of the corrected diskette.
SCRIPSIT VERSION 2.0 (26-4531)
The initial release of 2.0 SCRIPSIT has the following
known bugs:
1 . Sheet feeder error never gets reset.
2. Cosmetic problem in user key execution of define text
block.
3. Intermittent problem in D option in save/recall format line.
4. Exiting from a printer error in Merge hangs system.
5. The following patches will correct these errors.
PATCH SCRIPSIT A=D6F0 F=0000000000000000
C=AF3203DB3AFDDAC9
PATCH SCRIPSIT A=BA84 F=C50600 C=C3E0D6
PATCH SCRIPSIT A=D6E0 F=000000000000 C=D516003E0ACF
PATCH SCRIPSIT A=D6E6 F=00000000000000
C=D1C50600C387BA
PATCH SCRIPSIT A=D6F8 F=0000000000000000
C=ED73FBDACD15D9C9
PATCH SCRIPSIT/SYS R=155 B=223 F=3AFDDA C=CDF0D6
PATCH SCRIPSIT/SYS R=139 B=225 F=15D9 C=F8D6
PATCH SCRIPSIT/SYS R=154 B=124 F=300332D4DA
C=F500000000
PATCH SCRIPSIT/SYS R=154 B=132 F=3AD4DAB7 C=F
PATCH SCRIPSIT/SYS R=158 B=45 F=AF C=00
PATCH STARTUP A=E0B3 F=10 C=C0
PATCH STARTUP A=E40E F=AAAAAAAAAAAAAAAAAAAA
C=B1B0AFB1B6AFB1B9B8B1
When these patches have been made, the SCRIPSIT
initialization screen will show the date 10/16/1981 at the
bottom. After the first 1 000 or so, the disks had these patches
made at the factory. So, if that date is visible, no patches need
to be made.
■>-
The following patches will correct this problem:
1 ) At TRSDOS READY apply these patches on a backup
copy of SCRIPSIT 2.0.
NOTE: The patches listed just above must be applied prior to
these patches.
PATCH SCRIPSIT A=9EF8 F=FD7571 C=227490
PATCH SCRIPSIT A=9F5D F=7DFD9671 C=AFC3D0D6
PATCH SCRIPSIT A=9FBE F=0000000000000000
C=D5ED5B7490ED527D
PATCH SCRIPSIT A=D6D8 F=000000000000 C=D1E1E5C3619F
PATCH STARTUP A=E40E F=B1B0AFB1B6AFB1B9B8B1
C=B1B1AFB1B1AFB1B9B8B1
2) When these patches are made the SCRIPSIT initiali-
zation screen will show the date 11/11/1981 at the
bottom.
3) You are now ready to resume use of SCRIPSIT 2.0.
BI-SYNC. 3270(26-4715)
The following patches correct the polling problem with
the Bi-Sync Version 1 .0 package. The problem is character-
ized by slow response to Model II input.
1 . At TRSDOS READY apply these patches to a backup
copy of 4715.
PATCH BIS3270 A=DC15, F=000000000000000000000000 ,
C=3AB192FE00C83ACD92C35D7A
PATCH BIS 3270 A=7A5A, F=3ACD92, C=C315DC
2. You are now ready to continue use of 4715.
BI-SYNC. 3780 (26-4716)
The following patches correct the duplicate ACK prob-
lem with 26-4716 package. The problem is characterized by
duplicate print lines, duplicate disk data, or high retransmis-
sion rates.
1 . At TRSDOS READY apply the following patches to a
backup copy of the program diskette.
PATCH BIS 3780 A=7CEE F=000000000000000000000000
C=AF324A813E00326481C36350
PATCH BIS 3780 A=505E F=3E00326481 C=C3EE7C0000
2. You can now continue to use BI-SYNC 3780 (4716).
TRS-80 Microcomputer News, February 1982
35
Typewriter
David F. Salisbury
2991 Folsom Street
Boulder, CO 80302
Garbage Collection
William L. Pierce
THE NATIONAL ALLIANCE
P.O. Box 3535
Washington D.C. 20007
I am a journalist by profession and use my Model II
mainly for writing. There is absolutely no doubt that a micro-
computer with a word processor like SCRIPSIT is as great an
advance beyond the typewriter as the typewriter exceeded
the pen and pencil. However, I have found there are certain
cases - addressing a single envelope, for instance - where I
have longed for the simplicity of slipping a piece of paper into
a typewriter and punching away.
That feeling was the genesis for the following, exceed-
ingly modest program. This transforms my Model II/Printer
into an electric typewriter clone. It handles margins up to 255
characters and automatically returns the carriage following
the last word of each line. It has proven perfect for tasks
where full word processing is overkill.
If I have felt this way I imagine others have too. So I
thought I would share it with you. It is listed on the second
page of this letter.
By tying this into a simple diskette directory program, it
becomes faster and much less cumbersome to use than it is
to load SCRIPSIT, open a file, et cetera, et cetera.
Now my typewriter can truly rest in peace.
^TYPEWRITER MODE**"
100
200 CLS
: PRINT@112, "TYPEWRITER MODE"
300 PRINTI3272, "TO EXIT USE "9"
400 PRINT@346, "SET PRINTER MARGIN( 0=255 )" ;
: INPUT A
500 CLS
: F=0
600 IF A>79 THEN 1600
700 C$=INKEY$
800 IF C$="" THEN 700
900 IF C$=CHR$(92) THEN 200
1000 IF P0S(X)>=A THEN F=I
1100 IF F=l THEN IF C$=CHR$(32) THEN C$=CHR$(13)
1200 IF C$=CHR$(13) THEN F=0
1300 PRINT C$;
1400 LPRINT C$;
1500 GOTO 700
1600 C$=INKEY$
1700 IF C$="" THEN 1600
1800 IF C$=CHR$(92) THEN 200
190 IF ROW(X)/2<>INT(ROW(X)/2) AND POS(X)>=A-79
THEN F=l
2000 IF F=l THEN IF C$=CHR$(32) THEN C$=CHR$(13)
2100 IF C$=CHR$(13) THEN F=0
2200 PRINT C$;
2300 LPRINT C$ ;
2400 GOTO 1600
I noted with interest your information on minimizing the
"hang ups", during which the computer is cleaning up string
space, on page 3 of the October issue.
We have developed our own BASIC programs for mani-
pulating fairly large files of disk-based personnel records with
our Model II, and one of the problems which formerly caused
us a great deal of grief was the interminable "hang ups" or
"coffee breaks" (sometimes as long as 30 minutes) which the
computer took in going from one file to another. We learned
several tricks for reducing the length of these coffee breaks
somewhat, until we finally decided that the only way to elimi-
nate them (almost) completely is to CLEAR and reDIMension
all string arrays each time we load a new file into memory.
For example, a portion of the program line which sets up
memory for our string arrays is:
CLEAR 9000: DIM R(500,6)
We found that while it helped a little to insert an:
ERASE R: DIM R(500,6)
command sequence before loading each new file into mem-
ory, by far the better procedure is to use:
CLEAR 9000: DIM R(500,6)
each time. (Of course, all other arrays must also be redimen-
sioned after the CLEAR command.) This caused a few minor
program complications, but it was not too difficult to work
around them. The result of the change is that programs which
formerly took 1 2 hours to work their way through 26 alphabet-
ical files now take about 40 minutes.
When one is working with smaller arrays, the "hang up"
problem is not so severe, but if one is writing a program which
will be used with large arrays at some time in the future, it is
wise to avoid the problem from the beginning. We would
have saved ourselves a great deal of trouble if we had known
how long and frequent the Model II's "coffee breaks" would
be when our files grew in size.
36
TRS-80 Microcomputer News, February 1982
Color Computer
BASICally Speaking . . .
The information for this month relates to some of the
things that can be done with the BASIC resident in the Color
Computer and some of the things you need to be careful
about when using that BASIC.
As you probably know, the Color Computer includes a
random number generator which enables you to create a
series of random numbers. Unlike the Models I/III or II, the
Color Computer does not have a command to randomize the
random number "seed" (e.g. a RANDOM command.) What
this means is that the first time you turn on the computer, load
in your random number program (or a program that uses
random numbers), the first and subsequent numbers, al-
though appearing random, are the same set of numbers.
Sound confusing? Maybe this little program will explain
it better:
10 for x = 1 TO 5
20 A = RND(10)
30 PRINT A
40 NEXT X
Run the program. If you just turned the computer on,
keyed in and ran the program, the sequence of numbers will
probably be 5-4-2-7-5. If you run the program again, the
sequence of numbers will be different. If you run this pro-
gram, say, three times, write down the sequence of numbers
you get, turn the machine off and start again from scratch, the
three sequences of "random numbers" will be the same. A
random number is not of very much use when it can be
predicted. So . . . .try entering the following in your random
number program:
If you have standard color BASIC or Extended BASIC, at
the beginning of your program, (or somewhere that this
routine will be executed prior to selecting random numbers,
i.e.: a subroutine, GOTO, etc.) add a line like this to your
program:
1 A$=INKEY$:IF A$="" THEN A=RND ( ) : GOTO 1
If you turn on (after you have turned it off) the Color
Computer and enter the random number program including
the program line #1 , run it, and check the results, you will find
what is accepted in the computer world as a "random se-
quence of numbers". Line #1 will force you to press ENTER
(or any other key) to proceed with the program. All subse-
quent random numbers will be unpredictably random.
If you have Extended BASIC, another method of
generating a "random seed" for the random number genera-
tor is as follows:
1 A = RND( TIMER)
Using this method under Extended BASIC will give you
over sixty-five thousand different starting sequences possible
(65536 to be exact). Once the starting sequence is ran-
domized, all subsequent numbers will also be unpredictably
random.
As you can see, using either one of these routines will
give you vast starting sequences with the odds against dupli-
cating the same sequence consistently being astronomical.
A couple of Color Computer owners have brought to our
attention the following limitation for the Color Computer.
When using the PRINT USING function in Extended BASIC
along with the Exponential function, you are limited to expo-
nents of nine or less. If you try to use an exponent of 10 or
larger, the resulting answer will not be correct. My suggestion
here is to not use PRINT USING when using exponents and if
you must, limit them (exponents) to less than 10.
Some other users have commented that when using the
PCLEAR command in their programs, they don't always
work the way they should. First, let's see what is happening
inside the machine. We'll use the YO-YO program from the
Going Ahead with Extended BASIC manual. The program is
entered after power-up. This would have us in PCLEAR 4,
with four "pages" of memory reserved for graphics displays.
As we begin to enter the program lines, the computer starts
storing the program in "free" memory. After the program is
entered, we run the program and it "crashes." Before we get
angry, we try to run the program again. This time it works! This
is what has happened. The computer stored the program in
free memory. When the program is executed, the PCLEAR 8
command in line 10 is encountered. Since eight graphic
"pages" require more memory than four graphic "pages,"
the computer moves the program to a location not used by
the graphics memory grabbed by the Extended BASIC
ROM. This is why the program worked properly the second
time it was run. After the first attempt at running, the program
was moved, so any additional attempts at running the pro-
gram will be successful.
Based on this information, here are some things to watch
out for and some things you might use to avoid any possible
problems:
The major thing to avoid is the use of multiple PCLEAR
statements inside your program. If you initialize the program
with a PCLEAR 1 , start storing variables, then switch to a
PCLEAR 4, store some more variables, and finally switch to a
PCLEAR 8, by the time you go into the graphics display, the
machine could have lost track of where it is, and more impor-
tant, where and what the variables are!
The best suggestion under this type of circumstance is to
figure out the maximum number of graphics "pages" needed
at any one time for the entire program and PCLEAR that
many pages from the very start.
Even simpler than that is to use the PCLEAR statement
BEFORE you run your program. Simply type in PCLEAR 8,
then run the program WITHOUT the PCLEAR statement
inside your program. When you are writing your program,
use the PCLEAR statement prior to entering the program, so
the program will be stored where it does not need to be
moved in order to make room for additional graphics mem-
ory "pages". The same suggestion holds true for loading a
program. Prior to loading the program, use the PCLEAR
statement required for that program.
Does that make sense? Always keep in mind when
TRS-80 Microcomputer News, February 1982 37
you're writing programs how the PCLEAR statement works
and be careful with how you use it in your programming.
Now, on to a possibly obvious but still frequently asked
question about the Color Computer and BOOKS. Got your
attention, well read on. We at Radio Shack have been be-
sieged by requests for books on the Color Computer contain-
ing games and other assorted programs and hints. Well, I
can't say when, but we will have some in the "future." In the
mean time, might I suggest that you try using some of the
existing books available for the Model I. Many of the pro-
grams in these books are in BASIC and with a few modifica-
tions will probably work on the Color Computer. I wrote a
solitaire card game for the Model I "many moons ago" and
when the CC came out, I decided to convert it to run on the
Color Computer. Naturally I had to change the screen print
locations, respace some of the FOR-NEXT-STEP routines,
delete (or otherwise sidestep) various PEEK and POKE loca-
tions, but after making my "Getting Started" and "Going
Ahead" manuals dogeared, I finally got it to work right. (How
do you think I found my solution for the "random seed"
routine?)
Maybe one of these days I'll get up the nerve to put the
program listing in the Newsletter, but don't hold your
breath . . .
One last tidbit of information: For the early purchasers of
ourTRS-80 Videotex packages. If, when you purchased your
package, for whatever machine, you did NOT receive a Dow
Jones manual/ID number, drop by your local Shack, (it's best
to go to the store where you bought the package) and pick up
the Dow Jones upgrade package (stock number 700-2300).
It is free to you when you show proof of purchase. The store
may have to order you one, but the wait is worth it! Just like
CompuServe, you get the first hour of non-prime time use
free. Well, bye again and happy computing.
Joystick Draw Routine
Print Videotex
10 Y=2336
: CLS(0)
20 FOR X=3360 TO 16383
30 POKE X-Y, PEEK(X)
40 IF X-Y01535 THEN 90
50 Y=Y+512
60 I$=INKEY$
: IF 1$="" THEN 60
70 IF I$="P" THEN GOSUB H
80 CLS(0)
90 NEXT X
: END
100 L=0
: FOR P=1024 TO 1535
110 A=PEEK(P)
120 IF A>90 THEN A=A-64
130 A$=A$+CHR$(A)
: L=L+1
: IF L<>32 THEN 160
140 PRINT#-2,A$
150 L=0
: A$=""
160 NEXT P
170 RETURN
(From page 33)
Jim Ebbert
1680 N. Page Drive
Deltona, FL 32725
I have found that my Color Computer can do more than I
thought. It seems that every time I write a new program I find
something new about the computer. I tried the POKEs for the
color computer listed in the September, 1981 issue. They
worked O.K. but most of my long programs use high res.
graphics so I do not have much of a use for them.
I have included a short program that uses the right
joystick to draw on the TV. screen. You move the joystick and
the dot moves. If you press the red button it draws a line from
the center of the screen to where the dot was. When you
press the button the next time the line will go from the position
the dot was in the last time you pressed the button to your
current position etc . . .
To fill in an area drawn on the screen, put the dot in the
area and press P for paint. To change screens press 1 for
screen 1 or for screen 0.
That is it for that program, it is not complicated but it
works.
Here is the program:
10 DIM AC(1, 1)
20 PMODE 4, 1
: POLS
: SCREEN 1, 1
30 A=JOYSTK(0)*4
: B=J0YSTK(1)*3
40 GET(A, B)-(A, B), AC, G
: PSET(A, B)
: P=PEEK(65280)
50 IF P=126 OR P=254 THEN LINE-(A, B), PSET
: GOTO 90
60 A$=INKEY$
: IF A$="P" THEN PAINT(A+1, B+l), 5, 5
70 IF A$="l" THEN SCREEN 1, 1
80 IF A$="0" THEN SCREEN 1,
90 PUT(A, B)-(A, B), AC, PSET
: GOTO 30
I also thought you might be interested in some good
music so I included this song:
10 PLAY "T4 V31 L2 02 G 03 L2. F L6 E D C 02 B L2
B- LI B- L2 G L2. 03 G L6 F E D C 02 L2 B Ll
B L4 B- L2. A L4 B L6 03 C# D E F# G L2 A
Ll. B- 02 L2. B- 03 L4 C L6 D E- F G- A L2
B- Ll B 02 L2 G 03 L2. F L6 E D C 02 B L2 B-
Ll B- L4 A- L2 G Ll 03 G L6 F E D C 02 L2 B
Ll B L4 B- L2 A L4 B L6 03 C D E F E L2 G L4
GL2GUC L4DDDL1..C"
Note: Eliminate the spaces when you enter this line.
38 TRS-80 Microcomputer News, February 1982
3-D Color Graphics
Mark Granger
I have included two programs, both were written on the
TRS-80 Extended Color Computer and both use Hi-Res
graphics to the fullest.
I have been interested in animation and 3-Dimensional
graphics for a long time and I would like to share some of my
ideas with you and the readers.
The first program is an all-purpose 3-Dimensional
rotation program which I wrote from scratch on the Color
Computer.
I have tried to make the program as easy to use as
possible but it still requires instructions.
This is how to operate the program and create your own
shapes:
First of all, the program does have its limitations. For
example, do not use more that 15 lines because of memory
limitations. Also, do not make more than 36 steps of rotation.
'work' so it can take quite a long time to finish.
To enter a shape for rotation, press #1 . The computer will
then ask you how many lines you wish to enter and the x,y
and z coordinates for the end points of each lines. Do not
enter any number greater than 95 or less than -95. Generally
numbers around 40 or -40 work best. A simple shape to
enter is the 3 axis lines. Use the following data:
50,
0,
50,
0,
0,
50,
0,
-50,
0,
0,
50
0,
0,
-50
When you have finished entering the lines, the menu will
reappear. The next thing you will need to do is to set up the
rotation and compile the strings. Enter #2 and the computer
will give you the prompt 'RX, RY, RZ'. Enter degrees for the
shape to be rotated per step in each plane. (10,10,10 works
best.) It will then ask you how many steps to move the shape.
If you are unsure, type 36. For now, however, enter 21 .
The method I used to generate "fast" motion is to 'com-
pile' graphic strings and then draw them one after another
while flipping the graphic pages creating constant motion.
The end effect is almost as fast as machine code.
As the string is compiled, the shape will be plotted on the
screen. This is the time when the program does the actual
When it is done, type #3 to run the rotation. Using #4 you
can adjust the number of moves.
When you decide you like what you see, you can save
the shape to tape and load it again whenever you feel like it.
The second program is simple to use. It is just an old 3D
plot formula which I wrote for the Color Computer. When you
run it, type 'M' and a Hi-Res picture will be loaded off tape (if
you have saved a copy! The first time through, you will have
to use the 'P' option.) If you run the program and type 'P', you
can see the program draw the picture. It takes about 2 hours
to finish. After it is done, you can type
CSAVEM"SCRE£N", 1536,7679,0
to save the shape on tape for "instant" load later.
One last thing I would like to tell you is how to 'PCLEAR
0'. It is very simple. All you need to do is type the following
when you turn on the computer:
POKE 25, 6
POKE 27, 6
POKE 29, 6
POKE 31, 6
Type 'PRINT MEM' and you will discover that you now
have 1 4631 free bytes to play around with. I have been using
this and several RAM cram techniques to fit several basic
micro adventures and Star Trek onto my Color Computer. All
seem to operate very well. This seems to work on ALL
Extended Color Computers.
Program 1
10 CLEAR 5500
20 PI=3. 1415927
30 Tl=l
50 DIM P$(36)
55 GOTO 2000
56 CLEAR 5500
57 DIM P$(36)
: PI=3. 1415927
: Tl=l
60 CLS
: INPUT "NUMBER OF LINES"; L
70 DIM A(L,6)
80 FOR X=l TO L
90 INPUT "X1,Y1,Z1"; XI, Yl, Zl
100 INPUT "X2, Y2, Z2"; X2, Y2 , Z2
110 A(X, 1)=X1
A(X, 2)=Y1
A(X, 3)=Z1
A(X, 4)=X2
A(X, 5)=Y2
A(X, 6)=Z2
TRS-80 Microcomputer News, February 1982 39
2)
3)
120 NEXT X
125 GOTO 2000
130 CLS
: INPUT "RX, RY, RZ"; RX, RY, RZ
: INPUT "HOW MANY MOVES"; M
140 PMODE 4, 1
: PCLS
: SCREEN 1, 1
150 RX=RX*PI/180
: RY=RY*PI/180
: RZ=RZ*PI/180
160 FOR 1=1 TO 36
: P$(I)=""
: NEXT I
170 FOR 1=1 TO M
180 P$(I)=""
190 FOR X=l TO L
200 N1=A(X, 1)
: N2=A(X,
: T=RZ
210 GOSUB 1000
220 A(X, 1)=N1
: A(X, 2)=N2
230 N1=A(X, 4)
: N2=A(X, 5)
240 GOSUB 1000
250 A(X, 4)=N1
: A(X, 5)=N2
260 N1=A(X, 1)
: N2=A(X,
: T=RY
270 GOSUB 1000
280 A(X, 1)=N1
: A(X, 3)=N2
290 N1=A(X, 4)
: N2=A(X, 6)
300 GOSUB 1000
310 A(X, 4)=N1
: A(X, 6)=N2
320 N1=A(X, 3)
: N2=A(X,
: T=RX
330 GOSUB 1000
340 A(X, 3)=N1
: A(X, 2)=N2
350 N1=A(X, 6)
: N2=A(X, 5)
360 GOSUB 1000
370 A(X, 6)=N1
: A(X, 5)=N2
390 P1=INT(127+A(X,
400 P2=INT(96KA(X,
410 P3=INT(127+A(X,
420 P4=INT(96-(A(X, 5)))
430 P$(l)=P$(D+"BM" +
RIGHT$(STR$(Pl),LEN(STR$(Pl))-l)+ ","+
RIGHT$(STR$(P2),LEN(STR$(P2))-1)+ "M"+
RIGHT$CSTR¥(.F3;,LHN(STR$(P3))-1)+ ","+
RIGHT$(STR$(P4), LEN(STR$(P4))-1)
440 NEXT X
450 DRAW P$(I)
: NEXT I
470 GOTO 2000
480 CLS
: INPUT "NUMBER OF MOVES"; M
490 FOR 1=1 TO M
:. DRAW P$(I)
: SCREEN 1, 1
500 T1=-T1
: IF Tl=l THEN PMODE 2, 1 ELSE PMODE 2, 3
510 IF INKEY$="" THEN PCLS
: NEXT I
: GOTO 490
520 GOTO 2000
1000 D=SQR(N1~2+N2~2)
1010 A=ATN(N1/(N2+. 00001 ))
1020 A=A+T
1030 IF N2<0 THEN A=A+PI
1040
1050
1060
2010
2020
2030
2040
2050
2055
2060
2070
2090
3000
3010
3020
3030
3040
3045
3050
3060
4000
2)
D)
2)))
4))
4010
4030
4040
4050
4060
4065
4070
4080
N1=D*SIN(A)
N2=D*COS(A)
RETURN
CLS
PRINT@ 37, "3-DIMENSIONAL ROTATION"
PRINT@ 106, "** MENU **"
PRINT " 1 — ENTER SHAPE"
PRINT " 2 — SET UP ROTATION"
PRINT " 3 — RUN ROTATION
PRINT " 4 — CHANGE NUMBER OF MOVES"
PRINT " 5 — SAVE SHAPE TO TAPE"
PRINT " 6 — LOAD SHAPE FROM TAPE"
LINEINPUT "WHICH — "; Q$
: Q=VAL(Q$)
: IF Q<1 OR Q>6 THEN 2000
ON Q GOTO 56, 130, 490, 480, 3000, 4000
CLS
INPUT "FILE NAME"; F$
CLS
INPUT "SAVE — HIT RETURN WHEN READY"; Q$
CLS
: PRINT "NOW SAVING"
OPEN "0", -1, F$
PRINT#-1, L, M
FOR 1=1 TO L
FOR J=l TO 6
PRINT*- 1, A(I, J)
NEXT J, I
IF M=0 THEN 3060
FOR 1=1 TO M
: PRINT#-1, P$(I)
: NEXT I
CLOSE
: GOTO 2000
CLEAR 5500
Tl=l
PI=3. 1415927
CLS
INPUT "FILE NAME"; F$
CLS
INPUT "LOAD — HIT ENTER WHEN READY"; Q$
CLS
: PRINT
OPEN "I",
INPUT#- 1 .
DIM A(L,
FOR 1=1 TO L
FOR J=l TO 6
INPUT*- 1, A(I, J)
NEXT J, I
IF M=0 THEN 4080
FOR 1=1 TO M
: INPUT#-1, P$(I)
: NEXT I
CLOSE
: GOTO 2000
'NOW LOADING"
, -1, F$
, L, M
6), P$(36)
Program 2
10 CLS
: INPUT "PROGRAM OR MFILE (P OR M)"; A$
: IF A$="M" THEN 370 ELSE IF A$<>"P" THEN 10
20 DIM M(256, 1)
30 PMODE 4, 1
PCLS 1
COLOR 0, 1
SCREEN 1, 1
40 P=160
: Q=100
50 XP=144
: XR=1. 5*3. 1415927
60 YP=56
: YR=1
: ZP=64
70 XF=XR/XP
: YF=YP/YR
: ZF=XR/ZP
40 TRS-80 Microcomputer News, February 1982
80 FOR ZI=Q-1 TO -Q STEP -1.5
90 IF ZK-ZP OR ZI>ZP THEN 170
100 ZT=ZI*XP/ZP
: ZZ=ZI
110 XL=INT(.5+SQR(XP*XP-ZT*ZT))
120 FOR XI=-XL TO XL
130 XT=SQR(XI*XI+ZT*ZT)*XF
: XX=XI
140 YY=(COS(XT)+.4*COS(3*XT))*YF
150 GOSUB 210
160 NEXT XI
170 X2=0
: Y2=0
180 NEXT ZI
190 POKE 65494,
200 GOTO 200
210 T=(YY-ZZ)*.9
220 I=(XX+ZZ+P)*.7
: IF I>255 THEN RETURN
230 IF M(I, 1)=0 AND M(I, 0)=0 THEN M(I, 1)=T
: M(I, 0)=T
240 IF T>=M(I, 0) THEN M(I, 0)=T
: GOTO 270
250 IF T<=M(I, 1) THEN M(I, 1)=T
: GOTO 270
260 X2=0
: Y2=0
: GOTO 360
270 X1=(XX+ZZ+P)*.7
280 Yl=(YY-ZZ)*.9+Q+20
290 '
300 IF Y1=0 THEN X2=0
: Y2=0
: GOTO 360
310 IF Xl>255 OR Y2>191 THEN X2=0
: Y2=0
320 IF X2=0 OR Y2=0 THEN 350
330 IF YK0 OR Y1M91 THEN X2=0
: Y2 =
: GOTO 363
340 LINE(X2, 191-Y2)-(X1, 191-Y1).
350 X2=X1
: Y2=Y1
360 RETURN
370 PMODE 4, 1
PCLS
SCREEN 1, 1
CLOADM"SCREEN"
380 GOTO 380
390 SCREEN 1, 1
: GOTO 390
Space Alert
PSET
J.W. Myers
Route 2, Box 29
Bastrop, LA 71220
Enclosed is a program "Space Alert" which I have been
working on for the past two months. Complete documenta-
tion is included.
This program was written specifically for the TRS-80 4K
Color Computer and I have made full use of color and sound
in the program.
PROGRAM DOCUMENTATION
NAME OF PROGRAM:
PROGRAMMER:
DATE WRITTEN:
CURRENT VERSION:
SPACE ALERT
J.W.MYERS
JULY 10, 1981
SEPTEMBER 18, 1981
SPACE ALERT
By
J.W. MYERS
BACKGROUND:
Your spaceship is returning to Earth after a successful
journey to Jupiter. On approaching Mars your radar indicates
four Martian pirate spaceships are preparing to launch an
attack. The "Space Alert" signal is activated and all hands
rush to their "Battle Stations".
The number of attack missiles you have in your arsenal to
defend against this attack is determined by the Level of
Challenge selected. The four enemy ships are using destruc-
tive laser beams to try and destroy your ship. You have a firing
advantage over your adversaries which is also determined
by the Level of Challenge, but the laser weapons are more
accurate.
If you have an enemy ship within firing range and fail to
fire your missile within the time allotted then he is going to
"ZAP" you. To fire your missile in a horizontal plane, press the
(R) Key. To fire your missile in a vertical plane, press the (U)
Key. To get a stop action picture of the situation, press the
(Shift) Key and then the (@) Key. To restart the action, press
any key.
Both you and the enemy must have the same horizontal
or vertical coordinates before either of you can make a "hit".
Once you have fired a missile your radar automatically
switches to a position that enables you to follow the path of the
missile and see if you have made a "hit" or a "miss." If you
record a "miss," a two second delay keeps the shot on the
screen so you can see how far you were off target.
Your radar indicates how many "hits" and "misses" you
make, so you can plan your strategy based on the number of
missiles you have left.
Your spaceship shows up on the radar screen in an
orange color while the enemy may be any color except
orange.
You and your enemy are able to maneuver at the speed
of light to change positions in outer space.
You win if you destroy all four enemy spaceships. They
win if they destroy you or if you expend all of your missiles
without destroying their four ships.
TRS-80 Microcomputer News, February 1982
41
You have three (3) Levels of Challenge from which to
choose:
Number 1 is for beginners— This level allows you four (4)
seconds for firing the missile and gives you fourteen
(14) missiles.
Number 2 is for amateurs — This allows you two (2)
seconds for firing and seven (7) missiles.
Number 3 is for experts — This level allows you one (1)
second for firing and five (5) missiles.
These levels can be changed as desired in lines 5000
through 5050.
THE PROGRAM'S OPERATION
Since this program is composed in BASIC, even a begin-
ner should have no problem understanding its operation.
There are some unusual effects created in the program,
so this is a brief description of how it works.
This program was written specifically for the 4K RAM
TRS-80 Color Computer. Since this computer uses 1 .657 K
for color and sound basics, this leaves only 2.343 K for the
programmer's use.
It was a real challenge to program the "Space Alert"
game with the limited amount of memory. With all the short-
cuts utilized, the program required exactly 2K which left
.343 K to actually run the program.
Sound and color were used extensively throughout the
program, to add excitement to the game.
VARIABLES USED IN THE PROGRAM
A1
A2
(W,X,8)
O
(R.S.7)
(RQ.4)
(E.F.1)
(G,K,3)
J
M
J + M
C-(J + M)
Y1
Y2
F$
Games Won
Games Lost
(W,X) are the coordinates of your spaceships -
(8) colors your spaceship orange
Number of enemy ships destroyed
If = 1 :Then one enemy ship is deleted from
radar screen
If O = 2:Then two enemy ships are deleted from
radar screen
If = 3:Then three enemy ships are deleted
from radar screen
If = 4:You win the game
Enemy spaceship colored magenta
Enemy spaceship colored red
Enemy spaceship colored green
Enemy spaceship colored blue
Hits scored
Misses
Number of missiles fired
Number of missiles in your arsenal
Level of Challenge
Time allowed for firing missile
IN KEYS: Gives you the triggers for firing your
missiles
"U" to fire vertically
"R" to fire horizontally
The (X$ = INKEY$) instruction in the program
prevents wasting a missile should you inad-
vertently hit the F$ keys during other por-
tions of the program.
When the spaceships appear on your radar
screen, you have an alloted time, deter-
mined by the level of challenge, within which
to determine a go or a no-go on firing a
missile. The F$ = INKEY$ command is in-
serted in a position of the program so that the
missile is fired instantly upon pulling the trig-
ger, rather than waiting for the time to elapse.
After the delay, if you have not fired a missile,
the program moves through lines 300
through 310 to determine if you made the
right decision. If your decision to not fire was
correct, the program goes back to line 210
and the spaceships reappear in different po-
sitions on the radar screen.
If your decision was wrong then you go to line
2000 for your epitaph. (Note the special ef-
fects created by lines 2000 through 2030.)
* Lines 300 through 320 determine if you hit or missed the
enemy ship.
* Lines 370 and 380 fire the horizontal shot.
* Lines 380 through 400 determine if you hit or missed the
enemy ship.
* On hits you GOTO line 500 for your tally.
* On a hit one of the enemy ships disappears from the radar
screen. This is accomplished in lines 5500, 5510 and
5520.
You do not get credit for a double hit.
After four hits you GOTO line 3000 for your just reward.
* On misses you GOTO 600 for a comment.
If you run out of missiles you GOTO line 4000 for
instructions.
* Lines 5540, 5585, 5635 and 5685 eliminate the possibility
of an enemy ship and your ship having both coordinates
the same.
Since this TRS-80 has 8 different colors I was able to
create eye appealing backgrounds on the screen.
This TRS-80 also has 240 notes of sound — so sound
effects are used throughout the program to keep your atten-
tion and to amuse you.
THE PROGRAM:
CLS
: PRINT (§ 135,
'LEVEL OF CRALLEN
110 PRINT i3 202, "1.
BEGINNER"
120 PRINT (3 266, "2.
AMATEUR"
130 PRINT (3 330, "3.
EXPERT"
140 INPUT Yl
150 IF YK1 GOTO 130
160 IF Yl>3 GOTO 130
170 CLS(5)
: PRINT (3. 226,
'GAMES: WON =" Al
="; A2 ;
180 FOR Z=l TO 2500
: NEXT
190 CLS(4)
: PRINT @ 234,
'SPACE ALERT ";
200 FOR Z=l TO 60
: SOUND 215, 1
: X$=INK£Y$
: NEXT
210 CLS(0)
: W=RND(61)
: X=RND(31)
: SET(W, X, 8)
220 SOUND 10, 1
: G0SUB 5500
230 GOSUB 5000
240 FOR Z=l TO Y2
250 SOUND 190, 1
260 F$=INKEY$
LOST
42
TRS-80 Microcomputer News, February 1982
OR W=R GOTO 2000
OR X=S GOTO 2000
-2
270 IF F$="U" GOTO 330
280 IF F$="R" GOTO 370
290 NEXT
300 IF W=E OR W=G OR W=P
310 IF X=F OR X=K OR X=Q
320 X$=INKEY$
: GOTO 210
: NEXT
330 RESET(W, X)
: SET(W, 31, 8)
: FOR H=29 TO STEP
340 SET(W, H, 5)
: SOUND 195, 1
: NEXT
350 IF W=E OR W=G OR W=P OR W=R GOTO 500
360 GOTO 600
370 RESET(W, X)
: SET(0, X, 8)
: FOR 1=3 TO 61 STEP +2
380 SET(I, X, 5)
: SOUND 195, 1
: NEXT
390 IF X=F OR X=K OR X=Q OR X=S GOTO 500
400 GOTO 600
500 CLS(8)
: SOUND 200, 10
: J=J+1
510 0=0+1
520 PRINT @ 168, "A DIRECT HIT! ";
530 GOSUB 700
540 GOTO 640
550 END
600 FOR Z=l TO 1000
: NEXT
610 CLS(7)
: SOUND 170, 10
: M=M+1
620 PRINT @ 168, "A CLEAN MISS! ";
630 GOSUB 700
640 FOR Z=l TO 2500
: NEXT
: IF 0=4 GOTO 3000
650 IF J+M=C GOTO 4000
660 X$=INKEY$
: GOTO 210
700 PRINT @ 260, "HITS ="; J " MISSES ="; M;
710 N=C-(M+J)
720 PRINT @ 359, "MISSILES LEFT ="; N;
: RETURN
2000 FOR Z=l TO 5
: CLS(8)
2010 FOR H=0 TO 61
: SET(H, 15, 5)
: NEXT
2020 PRINT @ 224, "ZAP-SAP-ZAP-SAP-ZAP-
SAP-ZAP-SAP"
2030 SOUND 235, 3
: NEXT
2040 CLS(3)
2050 PRINT @ 228, "YOUR SHIP WAS DESTROYED ";
2060 FOR Z=l TO 3000
: NEXT
2065 A2=A2+1
0=0
J=0
M=0
2070 X$=INKEY$
: GOTO 170
3000 FOR Z=l TO 20
3010 CLS(4)
SOUND 50, 1
CLS(5)
SOUND 100, 1
NEXT
3020 CLS(2)
: PRINT <§ 226, "YOU HAVE DESTROYED THE
ENEMY";
3030 FOR Z=l TO 4000
: NEXT
3040
4000
4010
4020
A1=A1+1
0=0
J=0
M=0
GOTO 170
CLS(8)
: PRINT @ 227, "YOU ARE OUT OF AMMUNITION
A2=A2+1
0=0
J=0
M=0
FOR Z=l TO 4000
: NEXT
: GOTO 170
IF Yl=l THEN Y2
5010
5020
5030
5040
5050
IF Yl
IF Yl=2
IF Yl=2
IF Yl=3
30
1 THEN C=14
THEN Y2=13
THEN C=7
THEN Y2=6
5500
5510
5520
5530
5540
5550
5570
5580
5585
5590
5620
5630
5635
5640
5670
5680
5685
5690
5700
IF Yl=3 THEN C=5
RETURN
IF 0=1 GOTO 5570
IF 0=2 GOTO 5620
IF 0=3 GOTO 5670
R=RND(61)
: S=RND(31)
IF W+S=X+R GOTO 5530
SET(R, S, 7)
: SOUND 200, 1
: GOTO 5580
R=0
: S=0
P=RND(61)
: Q=RND(31)
IF W+Q=X+P GOTO 5580
SET(P, Q, 4)
: SOUND 210, 1
: GOTO 5630
P=0
: Q=0
E=RND(61)
: F=RND(31)
IF W+F=X+E GOTO 5630
SET(E, F, 1)
: SOUND 220, 1
: GOTO 5680
E=0
: F=0
G=RND(61)
: K=RND(31)
IF W+K=X+G GOTO 5680
SET(G, K, 3)
: SOUND 230, 1
X$=INKEY$
: RETURN
^/
TRS-80 Microcomputer News, February 1982
43
Bouncing Box
W. Tudor Apmadoc
Radio Shack Computer Center 7443
BOUNCING BOX PROGRAM
W. TUDOR APMADOC
RSCC 7443
DENSITY OF BOXES
# OF BOXES ON SCREEN
10
20
30
40
50
60 '
70 PCLEAR 4
80 DIM X(200), Y(200)
90 DIM Xl(200), Yl(200)
100 '
110 ' FIN
120 ' FO
130 '
140 FIN = 10
150 FO = 20
160 XTP = 255
: YTP = 191
170 A = RND(FIN)
: B = RND(FIN)
180 C = RND(FIN)
: D = RND(FIN)
190 POKE 65495,
200 PMODE 4, 1
210 PCLS 2
220 '
230 ' SET INITIAL POINTS
240 '
250 X = RND(XTP)
: Y = RND(YTP)
260 Xl= RND(XTP)
: Yl= RND(YTP)
270 SCREEN 1, 1
280 Tl = 2
290 FOR G = 1 TO FO
300 '
310 ' CHECK IF EXCEEDS SCREEN
320 ' LIMITS, IF SO SELECT NEW
330 ' RANDOM INCREMENT
340 '
350 IF X > XTP-FIN THEN A = -RND(FIN)
360 IF X < FIN THEN A = RND(FIN)
370 IF XI > XTP-FIN THEN B = -RND(FIN)
380 IF XI < FIN THEN B = RND(FIN)
390 IF Y > YTP-FIN THEN C = -RND(FIN)
400 IF Y < FIN THEN C = RND(FIN)
410 IF Yl > YTP-FIN THEN D = -RND(FIN)
420 IF Yl < FIN THEN D = RND(FIN)
430 '
440
450 '
460 X = X
B
INCREMENT POSITION
XI
= Y
Yl
A
XI
C
Yl
+ D
470 Y
480 *
490 ' DRAW BOX
500 '
510 LINE (X,Y)-(X1,Y1), PSET, B
520 IF FO = 1 THEN 650
530 '
540 ' STORE POINTS IN ARRAY
550 '
560 X(G) = X
: Y(G) = Y
570 XI (G) = XI
: Y1(G) = Yl
580 '
590 ' ERASE END LINE
600 '
610 LINE(X(T1),Y(T1)) - (Xl(Tl) ,Y1(T1)) .PRESET,
620 '
630 '
640 Tl = Tl + 1
: IF Tl > FO THEN Tl = 1
650 NEXT G
660 GOTO 280
: IF Tl > FO THEN Tl = 1
650 NEXT G
660 GOTO 280
Biorhythms
Kenneth A. Mowen
158 Royal Palm Drive
Leesburg, FL 32748
The theory of BIORHYTHMS is not subscribed to by
everyone. However, as there may be some substance to
these observations, I am submitting this program for possible
inclusion in the TRS-80 4K Color Computer section of your
most interesting publication.
The theory of BIORHYTHMS states that there are three
cycles to your life, which started the day you were born: The
PHYSICAL cycle, which is 23 days long; the EMOTIONAL
cycle, which is 28 days long; and the INTELLECTUAL cycle,
which is 33 days long.
The first half of each cycle is said to be UP period and the
last half the DOWN period.
When the cycle curve crosses the horizontal it is said to
be a CRITICAL time.
This program for the 4K Color Computer will give you the
number of days from the last critical period and tell you if the
period is UP or DOWN.
You will need to know your age, the number of leap years
since your birth and the number of days (including your
birthday) since your last birthday. The charts below will assist
you.
LEAP YEARS
1904 08 12 16 20
1924 28 32 36 40
1944 48 52 56 60
1964 68 72 76 80
DAYS IN THE MONTHS
Jan 31 Feb 28 Mar 31
Apr 30 May 31 Jun 30
Jul 31 Aug 31 Sep 30
Oct 31 Nov 30 Dec 31
10 CLS
15 PRINT "BIORHYTHMS"
20 PRINT
25 PRINT "REFER TO THE INSTRUCTION"
30 PRINT "GUIDE BEFORE RUNNING
35 PRINT
40 PRINT "ENTER YOUR AGE"
: INPUT A
45 PRINT
50 PRINT "HOW MANY LEAP YEARS"
55 PRINT "SINCE YOUR BIRTHDAY"
: INPUT L
60 PRINT
65 PRINT "HOW MANY DAYS FROM YOUR"
70 PRINT "BIRTHDAY, INCLUDING YOUR
75 PRINT "BIRTHDAY, TO THE TARGET DATE"
80 INPUT D
85 CLS
90 N=(A*365)+L+D
: PRINT "N="; N
100 X=N/11.5
: Y=INT(X)
: Z=X-Y
110 Z=Z*11.5
: X=X+.5
120 X=INT(X)
: P=X
: X=N/23
130 IF Z<.5 THEN P$="UP"
(Continued on page 46)
44
TRS-80 Microcomputer News, February 1982
Pocket Computer
Programs for Your Enjoyment
^% ■ ■■■ ■ ■■■■ I JL
Star Trek Fight
Robert Saccone
I own two computers; the TRS-80 Model III with one disk
drive and the Pocket Computer. I am submitting to you a
program for the pocket computer that simulates a fight be-
tween the Star Trek Enterprise and a Random number of
Klingons,
In the beginning of the program you are asked to enter
two numbers from 1-100. It is best to enter a large number
first then a smaller number next. Make sure there is a signifi-
cant difference between the numbers. When you enter this
program into the computer use all possible abbreviations
because this program leaves about 4 steps memories
open. Have fun with it.
1: PAUSE "STAR TREK"
INPUT "ENTER 2 NUMBERS (1-100)"; N, M
GOSUB 500
PRINT "KLINGONS TO KILL"; K
E=0
W=l
S=100
P=20
T=10
D=15
V=36
FOR Q=l TO 2
BEEP 1
PAUSE "RED ALERT ! ! "
NEXT Q
PAUSE "ENTER ONE"
: PAUSE "1=STATUS REPORT"
: PAUSE "2=FIRE PHOTON TORPEDOS"
PAUSE "3=FIRE PHASERS"
PAUSE "4=M0VE"
PAUSE "5=SELF DESTRUCT"
INPUT
IF 0=2 THEN 13
IF 0=3 THEN 19
IF 0=4 THEN 25
IF 0=5 THEN 28
P=P*5
T=T*10
PRINT "WARP IS: "; W
PRINT "SHIELDS ARE: "; S; "%"
PRINT "PHASERS ARE "; P;
PRINT "TORPEDOS ARE: "; T; '
: PRINT '"DIRECTION IS:
S=S-(0+V)
V=V+11
E=E+12.4*.3
T=T/10
P=P/5
PRINT "KLINGONS AT: '
IF S<=0 THEN 800
GOTO 3
INPUT "ENTER FIRING ANGLE"; A
: IF T<=0 PRINT "OUT OF TORPEDOS"
: GOTO 3
IF A>INT (((V+E)/2)) PRINT "SHOT WIDE! MISS!
: T=T-1
10:
11
"%"
"%"
D; "DEGS"
"KM.
12:
13:
14:
: GOTO 3
15: IF.A<INT (((V+E)/2)) PRINT "SHOT TOO LOW!"
: T=T-1
: GOTO 3
16: IF (A=INT(((V+E)/2))) +
((A+5)=INT(((V+E)/2))) +
((A-5)=INT(((V+E)/2))) PRINT "DIRECT HIT
17: PRINT "KLINGON DESTROYED!"
: K=K-1
: IF K<=0 THEN 600
18: T=T-1
: GOTO 3
19: INPUT "ENTER FIRING ANGLE"; L
: IF P<=0 PRINT "PHASER INOPERATIVE"
: GOTO 3
20: IF (L<>INT(((V+E)/2))) +
((L+5X>INT(((V+E)/2))) PRINT "MISS!"
: P=P-1
: GOTO 3
22: PRINT "DIRECT HIT!"
K=K-1
PRINT "KLINGON DESTROYED!"
P=P-1
IF K<=0 THEN 600
23: GOTO 3
25: INPUT "ENTER NEW ANGLE "; D
: INPUT "ENTER NEW WARP"; W
26: PRINT "DIRECTION IS NOW: "; D
: PRINT "WARP IS NOW"; W
27: GOTO 3
28: FOR Q=l TO 2
PAUSE "SELF DESTRUCTION "
BEEP 1
NEXT Q
29: IF (D+15<E)+(D-15>E)*(K>0) PRINT "KLINGONS
TOO FAR AWAY!"
: GOTO 700
31: PRINT "DESTROYED ALL KLINGONS"
PRINT "BUT YOU DESTROYED"
PRINT "YOURSELF"
GOTO 700
500: K=ABS (INT (2*N/M/2))
: RETURN
600: PAUSE "YOU HAVE DESTROYED THE"
: PAUSE "KLINGONS AND HAVE BEEN"
: PAUSE "PROMOTED TO"
601: PAUSE "ADMIRAL!"
: INPUT "PLAY AGAIN?"; Y$
602: IF Y$="NO" END
603: GOTO 1
700: PRINT "YOU HAVE LOST"
PRINT "OR SELF DESTRUCTED"
INPUT "PLAY AGAIN? "; Y$
IF Y$="NO" END
701: GOTO 1
800: PRINT "SHIELDS=0"
: GOTO 700
£/;
TRS-80 Microcomputer News, February 1982
45
Printer Plot
Herbert G. Dorsey, III
321 East Ojai Avenue
Ojai, CA 93023
Here are some graphic programs for the TRS-80 hand
held computer using the printer-cassette interface.
The first program was written for my girl friend who
thought that I was paying too much attention to the computer
and not enough to her. The dashes are spaces:
100:
P."— -XX XX"
101:
P."-X X-X X"
102:
P."X X X
103:
P."X 1 -LOVE— X
104:
P."-X X"
105:
P."— X— YOU X"
106:
P."— -X X"
107:
P." X X"
108:
P." X"
109:
END
Theoretically any kind of picture with 1 6 X N pixel resolu-
tion would be possible with this method. Different shades of
black could be printed using different letters.
By using the print command as a subroutine I have come
up with a method of plotting mathematical functions:
399:
"GRAPH"
: P. "PLACE F(X) ON LINE 410"
400
INPUT "A=", A, "B=", B, "D=", D, "M=" , M
401
X=A
: I=INT A
: C=I
: GOSUB 918
402
GOSUB 410
403
Y=INT(6Y/M+.5)
404
IF C=0 GOTO 406
405
GOSUB(909+Y)
406
X=X+D
: I=I+D
: C=C+D
407
IF X>B GOTO 409
408
GOTO 402
409
END
410
Y=SIN X
411
IF C=5 LET C=0
415
IF C=0 GOSUB 917
416
RETURN
900
P."*"
: RETURN
901
P."[]*"
: RETURN
902
P. "[][]*"
: RETURN
903
P. "[][][]*"
: RETURN
904
P. "[][][][]*"
: RETURN
905
?."[][][][][]*"
: RETURN
906
P. "[][][][][][]*"
: RETURN
907
■P." ETC.
915
P. "[][][][] [] [][][][][] t ][][][ 1 t 1 *"
: RETURN
916
: P."[]"
: RETURN
917
: P. USING "###";I;"+[][]+[][]+[][]+t][]+"
: RETURN
918
: P."[][]-1N-.5[]0N[].5[]1"
: RETURN
plot, B— the end value, D— the plotting increment and M, the
maximum value of Y. Also, M is the multiplying factor as the
graph here goes from -1 to 1 .
Singularities present problems in this program. For ex-
ample Tan X goes to infinity at 90 deg. This causes an error
signal to be displayed here. Some typical values of constants
would be: For SIN X in radian mode: A = 0, B = 4pi, D = 0.5,
M = 1; for ExpX: A = 0, B = 5, D = .5, M = 100, etc.
More plotting resolution could obtained for non-negative
functions by altering program to start the plot with zero at the
-1 position.
Well, somewhere I heard that the handheld TRS-80 did
not have graphic capability. I just wanted to point out that this
is not entirely true.
Biorhythms
(From page 44)
140 IF Z>.5 THEN P$="D0WN"
150 X=N/14
: Y=INT(X)
: Z=X-Y
160 Z=Z*14
: X=Z
: X=X+.5
170 X=INT(X)
: E=X
: X=N/28
180 IF Z<.5 THEN E$="UP"
190 IF Z>.5 THEN E$="D0WN"
200 X=N/16.5
: Y=INT(X)
: Z=X-Y
210 Z=Z*16.5
: X=Z
: X=X+.5
220 X=INT(X)
: I=X
: X=N/33
230 IF Z<.5 THEN I$="UP"
240 if z>.5 Then i$='"down"
250 PRINT P; "DAYS AFTER THE START OF THE"
260 PRINT "11.5 DAY "; P$; " PERIOD OF THE"
270 PRINT "PHYSICAL CYCLE"
280 PRINT
290 PRINT E; "DAYS AFTER THE START OF THE"
300 PRINT "14 DAY "; E$; " PERIOD OF THE"
310 PRINT "EMOTIONAL CYCLE"
320 PRINT
330 PRINT I; "DAYS AFTER THE START OF THE"
340 PRINT "16.5 DAY "; 1$; " PERIOD OF THE"
350 PRINT "INTELLECTUAL CYCLE"
360 END
fc.l i
The function to be plotted is entered on Line 410 of the
program. The input constants are A— the beginning value of
46 TRS-80 Microcomputer News, February 1982
•
<+£« ^**,
hEt
*.*>•
jap
i ■ ■ ■
Tl **i-utf
iti
#///
l_"-_ * \ -
if
T\ in* ° v> , i««th Or.ii - Mow* c " rwrtanOB * FEi
£° rteratof a *-< ChocKing Ace apS .
•■»i»* 4
Radio Shack Computer Center
Addresses and Telephone Numbers
ALABAMA
BIRMINGHAM 2428 Green Springs Hwy.,
(205) 945-0792
MOBILE 405 Bel-Air Blvd., (205) 471-1617
MONTGOMERY #24 Union Square S/C,
(205) 271-1500
ARIZONA
PHOENIX 10233 Metro Pkwy, E., (602) 861-1124;
4301 N. 7th Ave.. (602) 277-3031
TEMPE 83 E. Broadway, (602) 894 2065
TUCSON 5622 E. Broadway. (602) 748-0101
ARKANSAS
LITTLE ROCK Town & Country S/C, University &
Asher, (501) 568-5694
CALIFORNIA
ANAHEIM 509 Katella, (714) 776-9540
BERKELEY 1922 Grove St.. (415) 848-9170
BEVERLY HILLS 8500 Wtlshire Blvd.,
(2^3) 659-8870
CANOGA PARK 8371 Topanga Canyon,
(213) 347-9800
CARMICHAEL 6305 Fairojks Blvd.,
(916) 484-6815
ESCONDIDO 347 W. Mission Ave., 1714) 741-6032
FRESNO Princeton S/C, 2721 N Blackstone Ave..
(209) 225-5551
GLENDALE 236 N. Brand Blvd., (213) 246-9310
HAYWARO 20942 Mission Blvd.. (415) 278-2888
LAKE WOOD 5830 Lakewood Blvd.,
(213) 920-9671
LA MESA 5346 Jackson Dr., (714) 460-3610
LONG BEACH 2119 Beliflower Blvd.,
213) 597-3377
MONTEREY 484 Washington St., (408) 375-6430
MOUNTAIN VIEW 1933 El Camino Real W„
(415) 961-0542
PASADENA 575 S. Lake Ave., (213) 449-5424
RIVERSIDE 3844 La Sierra Ave.. (714) 689-0340
SACRAMENTO 4749 J. St., (916) 454-3287
SAN DIEGO 3062 Clairemont Dr. (714) 276-6050
SAN FRANCISCO One Market Place,
{415} 777-9810
SAN JOSE 1228 S. Bascom Ave., (408) 297-2603
SAN MATEO 3180 Campus Dr., (415) 573-8607
SANTA BARBARA *141 State St. A-1,
(805) 967-4538
STOCKTON College Sq. S/C, 963 West March
Lane. (209) 957-3676
VENTURA 4005 E. Main St., (805) 654-0196
WEST CDVINA 2516 E. Workman St.,
(213) 915-5791
COLORADO
BOULDER Arapahoe Pla2a. 3550 Arapahoe,
(303) 443-7142
COLORADO SPRINGS 4341 N. Academy,
(303) 593-7500
DENVER 8000 E. Quincy, (303) 770-1362
LAKEWOOD 2099 Wadsworth Blvd.,
(303) 232-6277
CONNECTICUT
EAST HAVEN 51 Frontage Rd., (203) 467-8864
FAIRFIELD 1196 Kings Hwy. & Rt. 1,
(203) 255-6099
MANCHESTER 228 Spencer St.. (203) 649-8210
NORWALK Rt. 7-345 Main Ave., (203) 846-3418
ORANGE Woolco S/C; 538 Boston Post Rd..
(203) 795-1291
WATERBURY 105 Bank St.. (203) 573-8800
WATERFORD 122 Boston Pod Rd,.
(203) 443-0716
WEST HARTFORD 39 S. Main St., (203) 523-4283
DELAWARE
WILMINGTON 3847 Kirkwood Hwy.,
(302) 999-0193
DISTRICT OF COLUMBIA
WASHINGTON 1800 M St. NW., (202) 822-3933
FLORIDA
CLEARWATER 2460-D US 19 North.
(813) 797-3223
HOLLYWOOD 429 S. State Rd. #7,
(305) 966-4382
JACKSONVILLE 8252 Arlington Exprwy.,
(904) 725-2594
MIAMI 9459 S. Oixie Hwy., (305) 667-2316; 1601
Biscay ne Blvd., (305) 374-6433; 15 SE 2nd
Ave., (305) 374-7310: 20761 S. Dixie Hwy.,
(305) 238-2518
ORLANDO 1238 E. Colonial Dr., (305) 894-0570
ST. PETERSBURG 3451 66th Si. N.,
(813) 381-2366
SARASOTA 5251 S. Tamiami Tr. (Hwy.41),
(813) 923-4721
TALLAHASSEE 2529 S. Adams. (904) 222-4440
TAMPA 4555 W. Kennedy, (813) 879-7470: 1825
E. Fowler Ave., (813) 971-1130
W. PALM BEACH 2271-A Palm Beach Lakes
Blvd., (305) 683-3100
GEORGIA
AUGUSTA 3435 Wrightsboro Rd., (404) 738-5998
ATLANTA 2108 Henderson Mill, (404) 939-9888;
49 W. Paces Ferry, (404) 231-9604; Akers Mill
S/C 2937 Cobb Parkway NW., (404) 955-5235;
113 Peachtree St.. (404) 223-5904
COLLEGE PARK 5309 Old National Hwy.,
(404) 761-3055
DORAVILLE 5697 Buford Hwy., (404) 458-2691
SAVANNAH Chatham Plaza. 7805 Abercom St.,
(912) 355-6074
IDAHO
BOISE 691 S. Capitol Blvd., (208) 344-5450
ILLINOIS
AURORA 890 North Lake St., (312) 844-2224
CHICAGO 4355 S. Archer Ave.. (312) 376-7617
ELMWOOD PARK 7212 W Grand Ave.,
(312) 452-7500
FAIRVIEW HEIGHTS u Market Place,
(618) 398-6410
HOMEWOOD/GLENWOOD 329 Glenwood Lansing,
(312) 758-0440
LaGRANGE One S. LaGrange Rd.. (312) 482-3484
LOMBARD 4 Yorktown Center, (312) 629-5350
NILES 8349 Goll Rd., (312) 470-0670
OAK LAWN 4815 W. 95th St.. (312) 425-9130
PEORIA 4125 N. Sheridan Rd., (309) 685-7056
ROCKFORD North Town S/C. 3600 N, Main St.,
(815) 282-1001
SCHAUMBURG 651 Mail Dr. (312) 884-8600
INDIANA
FT WAYNE 747 Northcrest S/C. (219) 482-9547
GRIFFITH 208 W. Ridge Rd.. (219) 838-3000
INDIANAPOLIS 6242 E. 82nd St., Castleton Plz.,
(317) 849-6896: Speedway Piaza. 6129 B
Crawlordsville, (317) 244-2221
IOWA
DAVENPORT 616 E. Kimberly Rd., (319) 386-3457
OES MOINES 7660 Hickman Rd.. Sherwood
Forest S/M. (515) 270-0193
KANSAS
OVERLAND PARK 8619 W. 95th, (913) 642-1301
WICHITA 2732 Blvd. Plaza S/C, (316) 681-1212
KENTUCKY
FLORENCE 7727 Mall Rd., (606) 371-2811
LEXINGTON 2909 Richmond Rd.. (606) 269-7321
LOUISVILLE 2900 Tayiorsville Rd.. (502) 459-9901
LOUISIANA
BATON ROUGE 7007 Florida Blvd..
(504) 928-5260
METAIRIE 3750 Veterans Hwy , (504) 454-3681
NEW ORLEANS 327 St. Charles Ave..
(504) 523-6408
SHREVEPORT 1545 Line Ave.. (318) 221-5125
MAINE
BANGOR Maine Square. (207) 945-6491
MARYLAND
BALTIMORE 7942 Betair Rd , Putty Hill Plaza,
{301} 882-9583
CATONSVILLE One Mile West S/C, 6600 B Bait
Nat' I. Pike, (301) 788-3277
ROCKVILLE Congressional Plaza, 1673 Rockville
Pike, (301) 984-0424
SALISBURY Shoppers World S/C, Rt. 50,
(301) 546-9223
MASSACHUSETTS
BOSTON 730 Commonwealth Ave ,
(617) 739-1704
BROCKTON 675 Belmont, (617) 563 2270
CAMBRIDGE Harvard Square, 28 Boylston St.,
(617) 354-7694
CHESTNUT HILL 200 Boylston St.,
1617)969-2031
NATICK 1400 Worcester Rd., (617) 875-8721
SAUGUS 3<3 Broad way (617) 233-4985
SPRINGFIELD 1985 Main St., Northgate Plz.,
(413) 732-4745
WORCESTER Lincoln Plaza. (617) B52-8844
MICHIGAN
BIRMINGHAM 3620 W. Maple Rd.,
(313) 647-2151
DETROIT DWNTN 1559 Woodward Ave.,
(313) 961-6855
FLINT G3298 Miller Rd . Yorkshire Plaza.
(313) 732-2530
GRAND RAPtDS 3142 28th St. SE.,
(616) 957-2040
KALAMAZOO 25 Kalamazoo Center,
(616)343-0780
LANSING 2519 S. Cedar St., (517) 372-1120
LIVONIA 33470 W. 7 Mile Rd,. (313) 476-6800
ROSEVILLE 31873 Gratiot Ave., (313) 296-6210
TROY Oakland Plaza, 322 John R. Rd.,
(313) 585-3900
MINNESOTA
BLOOMINGTON 10566 France Ave. S.,
(612) 884-1641
GOLDEN VALLEY Go den Valley S/C. 8016 Olson
Memorial Hwy.. (612) 542-8471
ST. PAUL 6th & Wabasha, (612) 291-7230
MISSISSIPPI
JACKSON 979 Ellis Ave., (601) 352-5001
MISSOURI
FLORISSANT 47 Florissant Oaks S/C,
(314) 921-7722
INDEPENDENCE 1325 S. Noland Rd.,
(816) 254-3701
KANSAS CITY 4025 N Oak Trafficway.
(816) 455-3381
ST. ANN 10472 S: Charles Rock Rd.,
(314) 428-1400
NEBRASKA
OMAHA 3006 Dodge St., (402) 346-4003
NEVADA
LAS VEGAS Commercial Center, 953 E. Sahara
#31-8, (702) 731-3956
RENO 3328 Kietzke Lane, (702) 826-6327
NEW HAMPSHIRE
MANCHESTER Hampshire Piaza. 1000 Elm St.,
(603) 625-4040
Radio /hack
TRS-80 Microcomputer News
P.O. Box 2910
Fart Worth. Texas 76113-2910
E W JERSEY
E. BRUNSWICK 595 A Rt, 18, (201) 23B-7142
E. HANOVER Rt. 10, Hanover Plaza,
(201) 884-1200
LAWRENCE VILLE Rt 1 & Texas Ave..
(609)771-8113
PARAMUS 175 Rt. 17 S., (201) 262-1920
SPRINGFIELD Rt *22 Center Isle, (201) 467-9827
NEW MEXICO
ALBUQUERQUE 2108 San Mateo NE.,
(505) 265-9587
NEW YORK
ALBANY Shoppers Pk., Wolf Rd.. (518) 459-5527
BAYSHORE 1751 Sunrise Hwy., (516) 666-1800
BETHPAGE 422 N. Wantagh Ave., (516) 822-6403
BUFFALO 839 Niagara Falls Blvd., (716) 837-2590
FRESH MEADOWS 187-12 Horace Harding Exp.,
(212) 454-1075
JOHNSON CITY Giant Shopping Center, Harry L.
Drive, (607) 729-6312
MELVILLE TSS Mall, Rt. 110, (516) 673-4646
NEW ROCHELLE 242 North Ave., (914) 636-0700
NEW YORK 385 Fifth Ave., (212) 889-1345
REGO PARK 97-77 Queens Blvd.. (212) 897-5200
ROCHESTER 3000 Winton Rd., (716) 244-6400
STATEN ISLAND 2409 Richmond Ave.,
(212) 698-3100
SYRACUSE 2544 Erie Blvd., (315) 446-3017
NORTH CAROLINA
CHARLOTTE 3732 independence Blvd.,
(704) 535 6320
GREENSBORO 371 B High Point Rd.,
(919) 294-5529
RALEIGH Townridge Sq.. Hwy. 70 W.,
(919) 761-9380
WINSTON-SALEM 629 Peters Creek Pkwy.,
(919)722-0030 mQ
AKRON Fairlawn P'aza. 2727 W. Market St.,
(216) 836-9303
CANTON 5248 Dressier Rd. NW„ (216) 494-7230;
Meilet Plaza, 3826 W. Tuscarawas,
(216) 478-1878
CENTERVILLE 2026 Miamisburg-Centerville Rd.,
(513)435-5167
CINCINNATI 9725 Montgomery, (513) 793-8688
CLEVELAND 419 Euclid
(Dwntwn). (216) 575-0800: 27561 Euclid Ave.,
(216) 289-6823
COLUMBUS 862 S. Hamilton, Great Eastern S/C,
(614) 864-2806
NORTH OLMSTED Great Northern S/C,
(216) 734-2255
TOLEDO 5844 W. Central Ave., (419) 531-5797
YOUNGSTOWN Union Square Piaza, 2543 Belmont
Ave.. (216) 744-4541
OKLAHOMA
OKLAHOMA CITY 4732 SE 29th St.,
(405) 670-4561; Springdale S/C, 4469 NW
50th. (405) 943-8712
TULSA 7218 & 7220 E. 41st St., (918) 663-2190
OREGON
EUGENE 390 Coburg Rd., (503) 687-0082
PORTLAND 7463 SW Barbur Blvd..
(503) 246-1157 9131 SE Powell,
(503) 777-2223
PENNSYLVANIA
ALLENTOWN Crest Plaza S/C, Cedar Crest Blvd.
US 22, (215) 395-7155
BALA CYNWYD 67 E. City Line Ave.,
(215) 668-9950
ERIE 5755 Peach St., (814) 868-5541
HARRISBURG Union Deposit Mall, Union Deposit
Rd. #17, (717) 564-6753
LANCASTER Park City Plaza, US 30,
(717) 393-5817
MONTGOMERYVILLE Airport Sq., Rt. 309,
(215) 362-1200
PHILADELPHIA 7542 Castor Ave.,
(215) 342 2217: 1002 Chestnut St.,
(215) 923-3080
PITTSBURGH 5775 Baptist Rd., Hills Plaza.
(412) 831-9694; 303 Smithfield St.,
(412)391-3150
SCRANTON 206 Meadow Ave.. (717) 348-1 B01
RHODE ISLAND
E. PROVIDENCE 850 Waterman Ave.,
(401) 438-2860
SOUTH CAROLINA
COLUMBIA Old Sears Bldg., 1001 Harden St..
(803) 799-2065
GREENVILLE N. Hills S/C, (803) 292-1835
N. CHARLESTON 5900 Rivers Ave..
(803) 747-5580
TENNESSEE
CHATTANOOGA 636 Northgatfl Mall,
(615) 870-1366
JOHNSON CITY Peer ess Center, (615) 282-6829
KNOXVILLE Cedar Bluff S/C, 9123 Executive Park
Dr., (615) 690-0520
MEMPHIS 4665 American Way. (901) 795-4963;
1997 Union Ave., (901) 272-3055
NASHVILLE 2115 Franklin Pike, (615) 298-5484;
Rivergate Plaza, (615) 859-3414
TEXAS
ARLINGTON 2500 E. Randol Mill, Suite 113,
(817) 274-3127
AUSTIN 8764 E. Research Blvd., (512) 459-4238
BEAUMONT 5330 Eastex Frwy.. (713) 898-7000
CORPUS CHRISTI 1711 S. Staple St..
(512) 687-8901
DALLAS 15340 Dallas Pkwy., Suite 1100,
(214) 934-0275; 2930 W. Northwest Hwy.,
(214) 350-4144
EL PASO 9515 Gateway West, (915) 594-8211
FT. WORTH 1 5 One Tandy Center,
(817) 335-7198; 2B01 Aita Mere,
(817) 738-0251
HOUSTON 211C-FM 1960, (713) 444-7006; 10543
Gulf Fwy., (713) 943-9310; 5900 North Fwy.,
(713) 699-1932; 6813 SW Fwy ,
(713) 777-7907; 809 Dallas St.. (713) 651-3002
HURST Northeast Mall, (817) 284-1518
LUBBOCK 3625 34th St.. (806) 793-1467
ODESSA 1613 "A" East 8th Street,
(915) 334-8355
RICHARDSON Fleetwood Sq S/C, 202 W
Campbeli Rd., (214) 669-1494
SAN ANTONIO 6018 West Ave., (512) 344-8792;
4249 Ceniergate, (512) 657-3958
UTAH
MURRAY 6051 S. State Ave., (801) 268-8978
SALT LAKE CITY 415 5th Ave., (801) 322-4893
ALEXANDRIA 4527 Duke St., Westend S/C.
(703) 370-9000
FAIRFAX Westtair Center, 11027 Lee Hwy.,
(703) 273-6500
NORFOLK 5731 Poplar Hall Dr., (804) 461-0798
RICHMOND Willow Lawn S/C, 1617 Willow Lawn
Dr., (804) 282-3453
ROANOKE Franklin Bldg., 3561 Franklin Rd. S.W.,
(703) 342-6335
WASHINGTON
BELLEVUE Crossroads Mall, North East 8th & 156
St., (206) 644-1804
FEDERAL WAY 33505 Pacific Hwy. South,
(206) 838-6830
SEATTLE 18405 Auiora Ave. N.. (206) 542-6184
SPOKANE 7702 N Division, (509) 484-7000; E.
12412 Sprague, (509) 922-2800
TUKWILA 15425 53rd Ave. S , (206) 248-3710
YAKIMA 1111 N. First St,, (509) 248-9667
WEST VIRGINIA
HUNTINGTON 2701 V* 6th Ave., (304) 523-3527
WISCONSIN
MADISON 57 West Towne Mall, (608) 833-6130
MILWAUKEE 6450 N. 76th St.. (414) 353-6790
WEST ALUS 2717 South 108th St„
(414) 327-4240